Get a real text width

  • Thread starter Thread starter Dmitri Shvetsov
  • Start date Start date
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
 
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.
 
Back
Top