user1553857
user1553857

Reputation: 197

Text/Font scaling on page printing

I would like to scale a lable/text when printing.

Below is the sample code i am using:

Graphics g = new Graphics();

g.ScaleTransform(1,2); //scale 200% at Y direction

g.DrawString(myText, myFont, myBrush, pointX, pointY); // pointX = 10; pointY = 5

The text is scaled to 200% at Y direction, but the location/point/coordinate of the text is being scale as well.

I want the text to be scaled without changing the pointX and PointY.

How to do that?

Upvotes: 0

Views: 508

Answers (1)

Peter Novikov
Peter Novikov

Reputation: 26

Please try:

g.TranslateTransform(pointX, pointY);
g.ScaleTransform(1, 2);
g.TranslateTransform(-pointX, -pointY);

g.DrawString(myText, myFont, myBrush, pointX, pointY);

Upvotes: 1

Related Questions