>>>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