Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Width of a TextBox
Message
De
11/03/2002 18:16:24
 
 
À
11/03/2002 06:48:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00630537
Message ID:
00631263
Vues:
23
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform