Partager via


AutoFit Method

Controls the automatic resizing of columns. AutoFit resizes all visible columns at the grid or browse window levels and resizes the individual column at the column level.

Object.AutoFit( )

Return Value

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

Remarks

Applies To: Grid Control | BROWSE Command | Column Object

You can use AllowAutoColumnFit when you create an object reference for the browse window using the NAME clause in the BROWSE command.

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

Reference

AllowAutoColumnFit Property

Resizable Property

Other Resources

Methods (Visual FoxPro)