TCustomStringGrid.AutoSizeColumn procedure
Automatically adjusts the width of a column to accommodate the widest text value in the column.
Declaration
procedure AutoSizeColumn(aCol: Integer)Description
AutoSizeColumn sets the column width to the length of the widest
text found in the column specified by
ACol.
AutoAdjustColumn is called to determine the width needed for the specified column number. The measurement includes optional title images and sort indicators for column headers, the text displayed for the cells using the Font or TitleFont for the control, and cell padding. Each row is visited to measure the content displayed in the column.
The calculated width is stored in ColWidths at the position in ACol.
Use AutoSizeColumns to calculated the sizes for all Columns on the grid control.
Include goDblClickAutoSize in the Options property to allow
columns to be automatically resized when a mouse double Click occurs on the
border in a cell header. In other words, when the resize cursor is visible.
See also
An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.
