StrUtil.MeasureMultilineTextHeight

omoba

Active Member
Licensed User
Longtime User
Hi ,

My code loads a text file and dipays. Then I use a seekbar to change font size. I need the "ht" in code below to change proportionally to the change in font size. Code below. Code below does not work perfectly ht changes but not proportionally.


Sub SetText
lblText.Text = txt
ht = StrUtil.MeasureMultilineTextHeight(lblText, txt)
scvText.Panel.Height = ht
lblText.Height = ht
scvText.ScrollPosition = 0
DoEvents

End Sub

Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
lblText.Text = SeekBar.Value
ht = StrUtil.MeasureMultilineTextHeight(lblText, txt)
ht = ht + (I need a value here to make the ht proportional increase with the font change)
scvText.Panel.Height = ht
lblText.Height = ht

End Sub


Pls any suggestions?
 
It was also suggested to set the Seekbar Min / Max values to appropriate font sizes if you have not already done so. suggestion only .. Min = 14 , Max = 50

Cheers mj
 
Upvote 0
Thanks Klaus that works great :D

Who would have thought?

MangoJack thanks for the reminder too.
 
Upvote 0
I have "lblText" but it does not exist in the layout designer.

How do I change the horizontal and vertical orientation of the text in "lblText"
 
Last edited:
Upvote 0
Back
Top