Text width

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Is there a way to determine how long (in twips) a given text string in a
given font will be on the screen?
 
System.Drawing.Graphics g = Control.CreateGraphics();

int intStringLength = g.MeasureString(string text, System.Drawing.Font
font);

Regards,

éric
 
What is "Control" in this example? The CreateGraphics() method of the
TextBox, Button, and ListBox controls is apparently not supported in the
Compact Framework.
 
I think the form control supports CreateGraphics
To measure a string any control will do.
éric
 
Back
Top