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

# TControl.SetBounds

Sets the bounds (Left, Top, Width, Height) of the control.

## Declaration

Source position: controls.pp line 1659

`public procedure TControl.SetBounds(`
`aLeft: Integer;`
`aTop: Integer;`
`aWidth: Integer;`
`aHeight: Integer`
`); virtual;`

## Arguments

`aLeft` |  | The X coordinate of the left side of the control.
`aTop` |  | The Y coordinate of the top of the control.
`aWidth` |  | The width of the control.
`aHeight` |  | The height of the control.

## Description

SetBounds can be used to change the Left, Top, Width, and Height properties as a single action. This reduces the overhead required for the common operation. Use DisableAutoSize and EnableAutoSize to reduce the overhead for recomputing/moving/resizing even further.

SetBounds is also called when any one of these properties, or the BoundsRect property is set. SetBounds updates BaseBounds and BaseParentClientSize, which are used by the anchoring mechanism to keep the spacing between controls. For example loading a Form with TMemo and the .lfm contains TMemo's Left and Width, then SetBounds is called two times for the memo.

When the user maximizes a window, SetBounds is called for the form, but not for the Memo, keeping the BaseBounds of the Memo. If the Memo is anchored to the right, the Width of the Memo is changed based on the BaseBounds and BaseParentClientSize.

Keep in mind that the given aLeft, aTop, aWidth, aHeight might not be valid and will be changed by the LCL before applied.

Delphi calls SetBounds more often. SetBounds calls ChangeBounds with the KeepBase argument set to False.