Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Programmatically center a label control
Message
De
14/01/2007 00:11:41
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
13/01/2007 23:59:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6
Divers
Thread ID:
01185419
Message ID:
01185420
Vues:
19
>If I want to center my label programmatically, how can I do that. I set the value of caption at run-time.
>
>So I do something like thisform.label1.left=(thisform.width-thisform.label1.width)/2
>
>But this won't center the label. Any help?

That should center the label, but if the text in the label is shorter than the label itself, it would be, well, to the left of the center if the label is left justified.
Set the label's .alignment=2 (centered) in addition to your centering it. It should look right then.

BTW, you don't have to calculate the position - this should be possible at design time by a button in the Layout toolbar, there is one to center the control horizontally.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform