No apparent equivalent to antialised text when using TextRenderer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been unable to draw antialiased text using TextRenderer (although
ClearType works just fine, we still need regular antialiased type in some
places). Is there a way to generate antialised text using TextRenderer other
than setting the TextRenderingHint on the DC in the Graphics parameter?

Thanks in advance for any answers or suggestions.

Josh Usovsky

In the following code snippet, the first two lines of text are rendered with
the single bit per pixel rendering hint:

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Font font = new Font("Tahoma", 12.0f, FontStyle.Regular);

e.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
TextRenderer.DrawText(e.Graphics, "Antialiased Text", font, new Point(0,
20), Color.Black);

e.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
TextRenderer.DrawText(e.Graphics, "Antialiased Text", font, new Point(0,
40), Color.Black);

e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
TextRenderer.DrawText(e.Graphics, "Antialiased Text", font, new Point(0,
60), Color.Black);
}
 
Aren't MSDN Universal members supposed to receive an answer from MSDN staff
for this question within 48 hours?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top