Is it possible to determine in code if the label box can display the entire string placed in it. If ther string is too long I want to reduce the font size
Is it possible to determine in code if the label box can display the entire string placed in it. If ther string is too long I want to reduce the font size.
You probably can, but it would be easier if you used a text
box instead of a label. In either case, the key to doing it
is to use Stephen Lebans' TextHeightWidth procedure at www.lebans.com
The code I use to reduce the font size to force fit the
contents of a text box within its height and width:
For intFS = 12 To 4 Step -1
txtbox.FontSize = intFS
If fTextWidth(txtbox) < txtbox.Width _
And fTextHeight(txtbox) < txtbox.Height _
Then Exit For
Next intFS