Reputation: 28586
I do the following when drawing:
Matrix m = new Matrix()
m.Scale(_zoomX, _zoomY)
e.Graphics.Transform = m
e.Graphics.DrawLine(...) ' line representation '
e.Graphics.DrawString(...) ' line text '
Now, the text became also scaled. Is it possible to avoid it?
Upvotes: 0
Views: 161
Reputation: 28586
In order to change only the point coordonates, use instead of:
e.Graphics.Transform = m
this one:
m.TransformPoints(points)
Upvotes: 1
Reputation: 4806
You'll have to undo the Graphics transform and draw your text with an Identity (or at least non scaling) transform.
Upvotes: 1
Reputation: 18387
Matrix work with image and do not distinguishes if it text or shape. If text position is not relevant, you can reset e.Graphics.Transform
Matrix oldMAtrix = e.Graphics.Transform;
e.Graphics.Transform = m;
e.Graphics.DrawEllipse(new Pen(Color.Black), 20, 20, 20, 20);
e.Graphics.Transform = oldMAtrix;
e.Graphics.DrawString("text", this.Font, SystemBrushes.ControlText, 10, 10);
Upvotes: 1