>>>Hi,
>>>
>>>A while ago I have experimented a little with anchor property of text boxes and labels so that if a user increases the size of the window, these controls increase as well. At that time I didn't like the result. I wonder if anybody is using the anchor property for these controls and happy with the results?
>>
>>A sample:
>>
>>PUBLIC oform1
>>
>>oform1=NEWOBJECT("form1")
>>oform1.Show
>>RETURN
>>
>>DEFINE CLASS form1 AS form
>>
>>
>> Top = 0
>> Left = 0
>> Height = 32
>> Width = 146
>> DoCreate = .T.
>> Caption = "Form1"
>> Name = "Form1"
>>
>>
>> ADD OBJECT text1 AS textbox WITH ;
>> Anchor = 15, ;
>> Value = "Sample Text", ;
>> Left = 5, ;
>> Top = 5, ;
>> Width = 133, ;
>> Name = "Text1"
>>
>>
>> PROCEDURE text1.Move
>> LPARAMETERS nLeft, nTop, nWidth, nHeight
>> this.FontSize = MIN(MAX(INT(21*(m.nHeight/21)^0.5) - 12,4),127)
>> ENDPROC
>>
>>
>>ENDDEFINE
>>
>
>Thank you, Fabio. It looks nice when I tried your example. I suppose I would have to add the .Move method to the base class of my textbox, to make it work for all of them, right?
Sure.
"Move" is the event that VFP provides you to control the Anchor functionality
With NODEF you can skip the Anchor effect