Partager via


AllowAutoColumnFit Property

Specifies how columns resize to the width of data automatically inside the grid or browse window. You can use AllowAutoColumnFit when you create an object reference for the browse window using the NAME clause in the BROWSE command. Read/write at design time and run time.

Grid.AllowAutoColumnFit [ = nValue ]

Return Value

  • 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

Applies To: Grid Control | BROWSE Command

Setting this property makes it possible for you to resize columns automatically to the width of 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. 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

Reference

AutoFit Method

Resizable Property

Other Resources

Properties (Visual FoxPro)