AllowAutoColumnFit Property

Specifies how columns automatically fit to data inside the Grid or Browse window. Setting this property enables you to automatically fit columns to data when you double-click the area between column headers, or the square immediately preceding the first column header in the upper and leftmost corner of a grid. Read/write at design time and run time.

Grid.AllowAutoColumnFit [ = nValue ]

Property Values

  • nValue
    Numeric data type. The following table lists the values for nValue.
    nValue Setting description
    0 Enables all or individual columns to fit data automatically. (Default)
    1 Enables only individual columns to fit all data automatically. "All data" refers only to all rows in the grid or browse window, not all records in the table.
    2 Disables capability for columns to fit data automatically.

Remarks

AllowAutoColumnFit affects interaction only through the user interface.

Fitting columns automatically to data occurs in both the left and right Grid or Browse panels, but only when either one or both are visible.

You can override AllowAutoColumnFit by using the AutoFit method, which resizes all or individual columns programmatically.

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

Header click events are not called because you click between the column headers.

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

Properties | Fitting Columns to Data Automatically | AutoFit Method | Resizable Property

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