Hi,
I am having an issue when calling Graphics.Save where it seems to double the transformation of the TextRenderer (when it comes to placement - I haven't checked it with other things)!
The below works fine and "Hello World!" is rendered in the top left of the box...
When you uncomment the "Dim state = e.Graphics.Save()" line it then seems to gets transformed in relation to the same transformation that it already had applied!
VB.Net Code:
Dim Control = DirectCast(sender, Control)
Dim Bounds = Control.ClientRectangle
Dim t As New System.Drawing.Drawing2D.Matrix
t.Translate(32, 32)
e.Graphics.Transform = t
Using p As New Pen(SystemColors.Highlight, 1)
e.Graphics.DrawRectangle(p, Bounds)
End Using
'Dim state = e.Graphics.Save()
TextRenderer.DrawText(e.Graphics, "Hello World!", Control.Font, Bounds, Control.ForeColor, TextFormatFlags.PreserveGraphicsTranslateTransform
Any sugguestions?
Thanks in advance,
Kris