Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Measuring Text 1

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
Hello all,

How do you determine text width when using proportional fonts? We are using a 3rd party grid which will automatically wrap column headers if they contain embedded spaces (eg Multi Column Header) if the user resizes them. But if I do it in code, it will print it all on one line and thus too wide.

I can split the headers into an array but what method do I use to calculate the text width (eg iiiii is always narrower than Thanks in advance for any ideas and/or suggestions!

Have a great day!
 
Thanks to both of you! CautionMP, I believe that link was in C++ so I have no way to translate it. Chrissie1, it works wonderfully after I added the following to create a Graphics object since the link used paint event args:
Code:
Dim e As System.Drawing.Graphics = Me.CreateGraphics()

Have a great day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top