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

# TControl.DoAutoSize

DoAutoSize - method for actually performing the AutoSize

## Declaration

Source position: controls.pp line 1026

`protected procedure TControl.DoAutoSize; virtual;`

## Description

TControl.DoAutoSize

IMPORTANT: Many Delphi controls override this method and many call this method directly after setting some properties.

During handle creation not all interfaces can create complete Device Contexts which are needed to calculate things like text size.

That's why you should always call AdjustSize instead of DoAutoSize.

## See also

AutoSize topic |  | AutoSize - boolean property that permits the size of a control to be adjusted automatically
TControl.AdjustSize |  | AdjustSize - Smart way to DoAutoSize

The latest version of this document can be found at lazarus-ccr.sourceforge.net .