How to find out text size

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

How to find out text width for specific font and text string. I need to
dynamically generate labels and set its size property.
TIA
 
Use Graphics.MeasureString

--
Bob Powell [MVP]
Visual C#, System.Drawing

Image transition effects, snap-to-grid and Layered Windows are
all discussed in May's edition of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 
* "Andy said:
How to find out text width for specific font and text string. I need to
dynamically generate labels and set its size property.

Notice that labels provide an 'AutoSize' property.
 
Back
Top