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);
}
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);
}