Private Sub FontToFitMultiLine(lbl As Label, MaxSize As Float)
lbl.TextSize = MaxSize
Do While su.MeasureMultilineTextHeight(lbl, lbl.Text) > lbl.Height
lbl.TextSize = lbl.TextSize * 0.9
Loop
End Sub
Youre right. I dont tested it on B4J.The link in post #4 is for single line texts not for multiline.
su.MeasureMultilineTextHeight
Text.MeasureHeight(Font1.ToNativeFont)
Yes but what I need is to adjust the label size to fit the font, not to change the font to fit the label size... is all the way arroundHave you tried StringUtils.MeasureMultilineTextHeight?
Drawing Multiline Text | B4X Programming Forum
This is my code to fit the textsize of a label:
B4X:Private Sub FontToFitMultiLine(lbl As Label, MaxSize As Float) lbl.TextSize = MaxSize Do While su.MeasureMultilineTextHeight(lbl, lbl.Text) > lbl.Height lbl.TextSize = lbl.TextSize * 0.9 Loop End Sub