When you draw a string on a C# form if you want to figure out how many pixel wide and high the text will be use:
TextRenderer Class
To measure the size you may use
TextRenderer.MeasureText :
It returns back System.Drawing.Size which has height and width of the text you wanted.
To draw text you may use:
private void RenderText1(PaintEventArgs e)
{
TextRenderer.DrawText(e.Graphics, "Regular Text", this.Font,
new Point(10, 10), SystemColors.ControlText);
}
for more details you may visit:
http://msdn.microsoft.com/en-us/library/system.windows.forms.textrenderer(VS.80).aspx
No comments:
Post a Comment