Get a real text width

D

Dmitri Shvetsov

Hi,

I need to get a maximum column width in a datagrid. I can get it in a
foreach row, but how can I get a real text width if a datagrid column in
pixels?

So, how can we get a real text width in pixels on a Windows Form?

Dmitri
 
P

Philip Rieck

You can use Graphics.MeasureString() to get a real text width in pixels in
Windows Forms. Make sure you use the font that the control in question is
displaying strings in.
 

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