Hallo,
How does one computationally determine whether the text within a WinLabel spans multiple rows or not. I need to resize the height of the WinLabel if so, according to the number of rows the text requires.
Thanks in advance,
Indika
Hi Indika,
There's really no easy way. You would have to account for the label's borders and then use MeasureString on a graphics object to determine the text size. Can't you just set the Label's AutoSize property to true?
Hallo
The Label's AutoSize property automatically resizes the width. Maybe it is possible to set the property to automatically resize the height?
Otherwise, I could monitor the difference between the specified width, and the width changed by the AutoSize property, and reset the width and recalculate a new height.
I don't think there's any way to tell it to it. There's a Protected Virtual property on the control called AutoSizeHeightOnly. So if you derive a class from UltraLabel you can set this property to true in the constructor of the derived class.
Yes, inheriting UltraLabel and raising a SizeChanged event works elegantly. Thank you.