Hi Vlado,
Because (in help for TXWIDTH()): ...returned for the current font for the main Visual FoxPro window or
the active output window. I'm want have sureness.
And your code doesn't accept properties DynamicFontSize,DynamicFontName etc.
MartinJ
>Hi, Martin!
>
>Why you use "_Screen.TextWidth" when there is a TxtWidth() function? This makes code quite heavy.
>
>Also, take a look to file#
9970 and article VFP Grids Part III that explains how it works. There is a header class with DblClick code to auto fit column. Also, that header class takes care that autofit is fired only when double click on resizing area of header (standard behavior in most applications), not anywhere on the header.
>
>HTH.
>
>>Hi Soykan,
>>
>>Insert code into method header.DblClick() every column..
>>
>>IF !This.Parent.Parent.SplitLineHitTest(This)
>> RETURN
>>ENDIF
>>....
>>
>>
>>If you add property
PropAsColumn into control (your classes texbox, combbox etc.) and set it to .T., then autofit respect dynamic properties on column.
>>
>> MartinJ
>>
>>>Hi All,
>>>how can I autofit of grid columns
>>>
>>>TIA