FOLLOW US
softpcapps Software CODE HELP BLOG

Shareware and free Open Source Windows Software Applications and free Online Tools

How to Avoid Bad Text Rendering when Drawing Text

To avoid bad text rendering when drawing text you have to set the TextRenderingHint of the graphics object to System.Drawing.Text.TextRenderingHint.AntiAlias.
For example :
	
 
	using (Graphics g = Graphics.FromImage(bmp))
	{
		g.Clear(Color.LightGray);			

		g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

		g.DrawString("hello world", this.Font, Brushes.Black, 50f, 50f);		
	}