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

# TControl.EnableAutoSizing

Enables automatic sizing for the control.

## Declaration

Source position: controls.pp line 1679

`public procedure TControl.EnableAutoSizing;`

## Description

EnableAutoSizing is used along with DisableAutoSizing to suspend and restore auto-sizing when the Parent, alignment, layout, visibility, or state for the control is updated. An exception is raised if EnableAutoSizing is called when DisableAutoSizing has not been called.

EnableAutoSizing decrements the internal counter used to track auto-sizing locks. When the counter reaches 0 (zero), the EnableAutoSizing method in the Parent control is called (when assigned). Otherwise, the DoAllAutoSize method is called to trigger the OnResize event handlers for the control.

It is not generally used in application code, but is needed by component developers.

## See also

TControl.DisableAutoSizing |  | Disables automatic sizing; implies that the default size is accepted, or sizing is done manually.
TControl.Parent |  | The control within which the control is shown.
TControl.DoAllAutoSize |  | Resizes and aligns the control and all of it children.