Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm going to guess that it's because you're using <a href="http://msdn.microsoft.com/en-us/library/system.drawing.graphics.drawstring.aspx" rel="nofollow noreferrer"><code>Graphics.DrawString()</code></a> instead of <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.textrenderer.drawtext%28v=vs.110%29.aspx" rel="nofollow noreferrer"><code>TextRenderer.DrawText()</code></a>. The former paints text using GDI+ which is sort of crappy and outdated. The latter uses GDI which is more modern (in terms of text rendering). I believe this is the difference noted by the previous answer (WinForms vs. Windows).</p> <p>You might also try the overload of <code>Graphics.DrawString()</code> that takes a <a href="http://msdn.microsoft.com/en-us/library/system.drawing.stringformat%28v=vs.110%29.aspx" rel="nofollow noreferrer"><code>StringFormat</code></a> object and specify <code>StringFormat.GenericTypographic</code>. However, this is really a bit of a hack around the problem. If you're using .NET 2.0 or later, you should be using the <code>TextRenderer</code> class instead of the crappy <code>Graphics</code> class for all of your text rendering needs. <code>Graphics.MeasureString()</code> and <code>Graphics.DrawString()</code> exist strictly for backwards compatibility with .NET 1.0 and 1.1.</p> <p>edit: Oh yeah, and your code leaks a GDI object on every paint cycle. Brush objects are managed wrappers around unmanaged resources thus they must be explicitly disposed.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload