tags:

views:

231

answers:

1

Given something like this:

thefont = New Font("Courier New", fontheight)

and this:

' g is a Graphics object

g.DrawString("some text", thefont, Brushes.Black, X, Y)

what can I put in the middle of the two to change the width of the font, so that "some text" is expanded or compressed horizontally but the height remains the same?

+1  A: 

You could do it using a scale transform, like this:

        Matrix m = new Matrix();
        m.Scale(3, 1);
        g.Transform = m;
        g.DrawString("Some text", this.Font, Brushes.Black, new PointF(10, 10));
        g.ResetTransform();
Guge
Perfect, thank you!