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

# TCustomStringGrid.AutoSizeColumns

Resizes all columns to accommodate the longest text value in each column.

## Declaration

Source position: grids.pas line 1804

`public procedure TCustomStringGrid.AutoSizeColumns;`

## Description

Automatically resizes all columns by adjusting them to fit in the longest text in each column. This is a quick way to perform the AutoAdjustColumn method for every column in the grid.

AutoSizeColumns calls the AutoAdjustColumn method for column numbers in the range 0..ColCount-1. Calculated column widths are stored at the corresponding positions in the ColWidths property.

Use AutoSizeColumn to adjust the width for a single column on the grid control.

## See also

TCustomStringGrid.AutoAdjustColumn |  | Adjusts the column size for the font, text length, and images used in the specified column.
TCustomStringGrid.AutoSizeColumn |  | Automatically adjusts the width of a column to accommodate the widest text value in the column.
TCustomStringGrid.Cells |  | Provides indexed access to a cell value by its column and row number.
TCustomDrawGrid.ColWidths |  | Provides indexed access to the Width for a column in the grid.
TCustomGrid.Columns |  | Definitions for the columns displayed the grid.
TCustomGrid.Options |  | Contains the set of optional features and/or behaviors enabled for the grid control.
TGridColumn |  | Implements a column definition used for tabular data in TCustomGrid.