Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Center form's caption
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00356420
Message ID:
00356510
Views:
16
Hi Mark,

This probably should work. But now I reconsider and decide not to center form's caption :)

Thanks.

>Form INIT:
>
>This.InvisibleLabel.Caption = "Test Centered Caption"
>nDiff = int((This.Width - This.InvisibleLabel.Width)/2)
>nSpaces = int(nDiff/5) && width of a space -- Aerial, fontsize 9
>This.Caption = space(nSpaces) + This.InvisibleLabel.Caption
>
>You could put a second invisible label on the form and make its caption 1 space so you can get the width of it. Make sure autosize is true for those labels. Works for me.
>
>>Doesn't work for me :(
>>
>>>Put a label on your form and set its visible property to false.
>>>
>>>ThisForm.InvisibleLabel.Caption = 'Table Maintenance for ' + proper(pcTable)
>>>
>>>Now you can use the width property of the label and subtract it from the width of the form. Divide that by 2 times the width of a space. Then padl() the caption with that number of spaces.
>>>
>>>>Hi everyone,
>>>>
>>>>Simple problem: I want to center caption of my form, so I tried:
>>>>
>>>>
>>>>this.caption=padc('Table Maintenance for '+proper(pcTable),this.width)
>>>>
>>>>Didn't work.
>>>>
>>>>What should I do?
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform