AutoFit Method

Use to control automatic resizing of columns. AutoFit resizes all visible columns at the Grid or BROWSE levels and resizes the individual column at the Column level.

Object.AutoFit( )

Return Values

Boolean data type. AutoFit returns True (.T.) if columns are successfully resized and False (.F.) if not successfully resized.

Remarks

Setting the AllowAutoColumnFit property does not affect resizing performed by AutoFit at either the Grid or Column level. You can override AllowAutoColumnFit using AutoFit.

For Column objects, AutoFit works only with TextBox controls. When a column resizes, the Resize event for that column fires.

You can prevent the automatic resizing of a particular column by setting the Resizable property of that column to False (.F.).

Hidden grid columns, which have their Visible property set to False (.F.) and have a Width property value of 0, are not resized.

See Also

Methods | Fitting Columns to Data Automatically | AllowAutoColumnFit Property | Resizable Property

Applies To: Grid Control | BROWSE...NAME Command | Column Object