I have a custom control that used a lot of Label controls inside, and i started experiencing performance issues when drawing/redrawing the screen So i decided to remove them as they look overwhelming and just draw the texts I needed
I started using Graphics.DrawString method, which was SUPER fast and the performance when resizing/redrawing the screen was perfect, but then I noticed the text render wasn't exactly the same as the one Labels uses, and didn't look that good.
I then found out about
TextRenderer.DrawText
method and I switched to it, but the problem came back again, when you resize the form/control the performance is awful.
Is this a normal behavior? I researched a bit and came to read that
TextRenderer.DrawText
is preferable and better as it uses GDI+ as opposed as GDI, but this clear is not my case?
We are talking about a 100% standard WinForm vb.net app with
VisualStyles
enabled.
What I have tried:
TextRenderer.DrawText(e.Graphics, "Hello World", Me.Font, New Rectangle(1, 1, 200, 20), Me.ForeColor, TextFormatFlags.Left)
e.Graphics.DrawString("Hello World", Me.Font, _Brush, New Rectangle(1, 1,200, 20), _StringFormat)