Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Formula for font size and textbox width
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00455959
Message ID:
00455966
Views:
30
>I'm sure this has been asked before, but the search isn't working. Is there a formula that will take the font, font size, and the number of characters and return what width the textbox should be set to? I realize proportional fonts make things harder, but if it used an average character width, that would be fine.
>
>Thanks,
>
>Michelle

Michelle,
Try:
Txtbox1.Width = Txtbox1.Maxlength*fontmetric(7,Txtbox1.Fontname,Txtbox1.FontSize)

You will also have to take into account the attributes like Bold, Italic, etc. You can build a string based on those properties and pass that as the fourth parameter to Fontmetric.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform