Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Put form's caption into the center of the title bar
Message
De
23/02/2007 03:57:36
 
 
À
22/02/2007 14:05:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01198086
Message ID:
01198215
Vues:
7
>>>Hi all
>>>I want to centerlize my form caption.
>>>I got very huge strange by the following command:
>>>
thisform.caption=space((thisform.width/2)-len(thisform.caption)/2)+thisform.caption
>>>Help please...
>>
>>The width is measured in pixels (assumning default ScaleMode property). You could probably use FontMetric to calculate the required number of spaces based on the number of pixels
>>Viv
>
>But how can I move the caption to center, only by space, No?

In VFP - I think Yes.
Actually the .TEXTWIDTH approach probably works better (FONTMETRIC(6) only gives the average character width). Try in .Resize:
lcCaptionString = LTRIM(This.Caption)
this.Caption = SPACE(((this.Width - this.TextWidth(lcCaptionString))/2)/this.TextWidth(" "))+ lcCaptionString
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform