Sub SetLabelTextSize(lbl As Label, txt As String, MaxFontSize As Double, MinFontSize As Double)
Dim FontSize = MaxFontSize As Double
Dim Height As Int
Dim stu As StringUtils
lbl.TextSize = FontSize
Height = stu.MeasureMultilineTextHeight(lbl, txt)
Do While Height > lbl.Height And FontSize > MinFontSize
FontSize = FontSize - 1
lbl.TextSize = FontSize
Height = stu.MeasureMultilineTextHeight(lbl, txt)
Loop
End Sub
Sub SetEdittextTextSize(et As EditText, txt As String, MaxFontSize As Double, MinFontSize As Double)
Dim FontSize = MaxFontSize As Double
Dim Height As Int
Dim stu As StringUtils
et.TextSize = FontSize
Height = stu.MeasureMultilineTextHeight(et, txt)
Do While Height > et.Height And FontSize > MinFontSize
FontSize = FontSize - 1
et.TextSize = FontSize
Height = stu.MeasureMultilineTextHeight(et, txt)
Loop
End Sub