text overflow in Label

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

is there any way I can adjust the behavior of a Label when text overflows
it's boundaries?

I have a specific size Label which can show 2 lines of text, but on some
occassions the text I insert may be longer. On such occassion, you can see
the top of a third line of text just above the bottom border of the Label
(the text is cut off by the boundary of the LAbel)

I would rather have it not display this third line at all (stop printing
text onces a specific boundary is reached) but instead I have a ToolTip on
that Label which will show the entire text within the ToolTip.

So how do modify Label so it stops displaying text after 2 lines have been
used up?
 
You can figure out how many display units there are in two lines of your
label, then dynamically figure out how many units in the text your posting
(as different fonts/sizes will matter), then cut it off at max units. Did
something like this once but don't remember the exact code to use.
 
Hi thanks for your reply!

would you elaborate a bit more on "display units" ?

anything to do with getting rectangles that the text would fit in and
comparing it to rectangle of space available in the label?
 
Back
Top