Calculate the lenght of text?...

V

VcDeveloper

How do I calculate the lenght of text word? For example I want lenght of
each of my column in a listView so I can set there width.

I now how to do it in vc++ 6.0, but how is it done in Csharp?

Thanks!...
 
P

Peter Duniho

VcDeveloper said:
How do I calculate the lenght of text word? For example I want lenght of
each of my column in a listView so I can set there width.

The Graphics.MeasureString() method is one way to determine the
graphical dimensions of a string. That _seems_ to be what you're asking
about, but if it's not you should probably be more specific about what
"length" you want.

Pete
 
M

Michael Nemtsev, MVP

Hello VcDeveloper,

see sample there http://msdn2.microsoft.com/en-us/library/system.drawing.graphics.measurestring.aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


V> How do I calculate the lenght of text word? For example I want lenght
V> of each of my column in a listView so I can set there width.
V>
V> I now how to do it in vc++ 6.0, but how is it done in Csharp?
V>
V> Thanks!...
V>
 
V

VcDeveloper

Thanks Micheal, the graphics namespace was the solution! Also, thanks to
you Peter!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top