[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'DBGrids' (#lcl)

# TCustomDBGrid.AutoAdjustColumn

Adjust properties in the specified column to display the longest value.

## Declaration

Source position: dbgrids.pas line 418

`protected procedure TCustomDBGrid.AutoAdjustColumn(`
`aCol: Integer`
`); override;`

## Arguments

`aCol` |  | Column (or field) number affected in the method.

## Description

AutoAdjustColumn is an overridden method in TCustomDBGrid used to adjust column properties to accommodate the largest value in the specified column. It re-implements the method from the ancestor class.

AutoAdjustColumn uses the column definition, or the field from the linked dataset, to determine the column or field size needed for the data displayed on the control canvas. A temporary TCanvas instance is created and used to measure the text width for the column. The calculated width is stored in the inherited ColWidths property.

Remark: | Columns which use the ftMemo field type do not display the content for the memo field unless dgDisplayMemoText has been included in the Options for the grid control.

AutoAdjustColumn is called from the DblClick method when the values goColSizing and goDblClickAutoSize have been included in the Options property.

Use AutoAdjustColumns to resize all automatically-sized columns in the control.

## See also

TCustomDBGrid.AutoAdjustColumns |  | Updates the widths for automatically-sized columns in the grid control.
TCustomDBGrid.Columns |  | Columns provides access to columns defined for the database grid control.
TCustomDBGrid.Options |  | Contains the optional features or behaviors that are enabled for the grid control.
TCustomGrid.AutoAdjustColumn |  | Adjusts column properties to accommodate the largest value in the specified column.
TCustomGrid.ColWidths |  | Provides indexed access to the Width for a column in the grid.