.net - Windows forms: how get the actual width of the item in the list box -


To ensure that the text in the listbox items is not minimized, I want to extend my width to the longest Want to adjust the text?

Is there a way to get a "real" width of the list box item which is based on the text of the item.

ListBox.GetItemRectangle is not coming back to this actual width.

Thank you.

measurement string method: (copy copy MSDN)

  graphics = Control CreateGraphics (); Int width = (int) g.MeasureString (aString, control.Font). With; G.dispose ();  

Add a text box width (left and right)


Comments