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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where is "textwidth" in C# express? 1

Status
Not open for further replies.

murrayja

Programmer
May 6, 2000
90
US
I would like to obtain or calculate the width in pixels that a string will occupy in a control (listview). In VB6 there was 'textwidth()' for this but I can't find anything to use in C#.
The Font object almost helps but there is no average character width.

Help anyone?

 
Take a look at MeasureString() in the Graphics object. It will probably do what you want.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
That helped but I have to 'fudge' the result by 4/3.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top