How to fit the lable height to its text content

gkumar

Active Member
Licensed User
Longtime User
How to fit the label height to its text content (Text length is not fixed), and whatever may be the font style.
 
Last edited:

gkumar

Active Member
Licensed User
Longtime User
Thanks Klaus,

I am adding lable to panel using add view like,
panel.AddView(column1Label, 0, 0, Panel. Width-15, ??????)

It is not possible to check the label hight before adding it to panel.
 
Upvote 0

gkumar

Active Member
Licensed User
Longtime User
I tried -2, label not showing its text, and If I retrieve label height after that it returns -2.
But the first method using the string utils works, but that works only after adding label to panel with setting height as some other value, then calculting actual height and changing it.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Hi gkumar,
You say that -2 doesn't work, but you didn't say what you have done.
The attached test program shows that it does work.
That's what -2 (WRAP_CONTENT) is made for.

Best regards.
 

Attachments

  • LabelHeight.zip
    5.7 KB · Views: 526
Upvote 0
Top