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

# TWinControl.SetBounds

Sets the control bounds and adjusts child and docked controls.

## Declaration

Source position: controls.pp line 2380

`public procedure TWinControl.SetBounds(`
`ALeft: Integer;`
`ATop: Integer;`
`AWidth: Integer;`
`AHeight: Integer`
`); override;`

## Arguments

`ALeft` |  | The X coordinate for the left side of the control.
`ATop` |  | The Y coordinate for the left side of the control.
`AWidth` |  | The width for the control.
`AHeight` |  | The height for the control.

## Description

SetBounds is an overridden method in TWinControl. used to set the bounds for the control to the values in the ALeft, ATop, AWidth, and AHeight arguments.

No actions are performed in the method when the internal BoundsLockCount member has a non-zero value. In other words, when BeginUpdateBounds has been called and EndUpdateBounds has not been called.

At design-time, SetBounds checks to ensure that negative is not present in the Width or Height properties when the user has changed the bounds for the control.

SetBounds calls DisableAutoSizing to reduce the overhead for recomputing/moving/resizing when the bounds are changed. The inherited method is called to apply the new values in ALeft, ATop, AWidth, and AHeight. EnableAutoSizing is called to re-enable auto-sizing when the operation has been completed.

SetBounds is called when any one of these Left, Top, Width or Height properties, or the BoundsRect property has been changed.

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

## See also

TWinControl.BeginUpdateBounds |  | Starts an update to the Bounds property; disables SetBounds by incrementing BoundsLockCount.
TWinControl.EndUpdateBounds |  | Ends an update to the Bounds property; decrements BoundsLockCount and eventually calls SetBounds.
TControl.SetBounds |  | Sets the bounds (Left, Top, Width, Height) of the control.
TControl.ChangeBounds |  | Sets the bounds (left, top, height, width) and optionally the BaseBounds of the control.
TControl.DisableAutoSizing |  | Disables automatic sizing; implies that the default size is accepted, or sizing is done manually.
TControl.EnableAutoSizing |  | Enables automatic sizing for the control.