Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Width of a TextBox
Message
From
11/03/2002 18:16:24
 
 
To
11/03/2002 06:48:40
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00630537
Message ID:
00631263
Views:
24
>It did not work properly. I got the answer as 66 with following command
>
>?FONTMETRIC(7,"MS Sans Serif",9)*LEN("WWWWWW")
>
>After changing the width to 66 also, last 'W' did not get displayed fully.

As Hilmar and Caroline already pointed out, you also must take the border and margin in consideration. Also, an extra 2 pixel constant seems appropriate (create a label with .caption="WWWWWW" and .autosize=.t. and you get a 68 .width) so unless someone else comes with a better formula it should be
Text.Width = FONTMETRIC(7,oText.FontName,oText.FontSize)*oText.MaxLength+oText.Margin*2+oText.BorderStyle*4+2
----------------------------------
António Tavares Lopes
Previous
Reply
Map
View

Click here to load this message in the networking platform