Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Center form's caption
Message
From
06/04/2000 16:46:20
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00356420
Message ID:
00356526
Views:
14
>>>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?
>>
>>
Nadya,
>>Caption font and size changes by installation. You should first read its setting. Assuming it's Arial,12 you could do something like this :
>>
*form.init
>>this.caption = ;
>>  padc(this.caption,;
>>  (WCOLS( )-;
>>  TXTWIDTH(this.caption,'Arial',12)*;
>>  FONTMETRIC(6,'Arial',12)/FONTMETRIC(6)))
Cetin
>
>Hi Cetin,
>
>Doesn't work :( Visually seems to closer to left corner:
>
>
>local lcCaption
>lcCaption='Table Maintenance for '+ proper(pcTable)
>this.caption = ;
>     padc(lcCaption,;
>     (wcols( )-;
>     txtwidth(lcCaption,'Arial',12)*;
>     fontmetric(6,'Arial',12)/fontmetric(6)))
>
>
>I tried this.FontName, this,FontSize instead of Areal,12 and wfont(1),wfont(2),wfont(3). Same result for all three attempts...


Little math error :) Try this one :
* Init and resize. Form.scalemode = 0 - Pixels
lcCaption = "Maintanence form for "+proper("mytable")
lcFont = "Tahoma"  && My title bar font settings 
lnSize = 8
lcStyle = "B"
lnCaptionWidth = txtwidth(lcCaption,lcFont,lnSize,lcStyle)*;
                 fontmetric(6,lcFont,lnSize,lcStyle)
lnSpaces = (this.width-lnCaptionWidth) / ;
    (txtwidth(" ",lcFont,lnSize,lcStyle)*;
     fontmetric(6,lcFont,lnSize,lcStyle)) / 2
this.caption = space(lnSpaces)+lcCaption
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform