[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Sets the bounds (left, top, width, height) of the control.
Source position: controls.pp line 1519
public procedure TControl.SetBounds( |
aLeft: Integer; |
aTop: Integer; |
aWidth: Integer; |
aHeight: Integer |
); virtual; |
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. |
SetBounds can be used to change the left, top, width, height all at once, reducing some overhead.
Use DisableAutoSize/EnableAutoSize to reduce recomputing/moving/resizing further.
SetBounds is called when the properties Left, Top, Width, Height, or BoundsRect is set.
SetBounds updates the BaseBounds and BaseParentClientSize, which are used by anchoring to keep the distance. 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 KeepBase=false.
lazarus-ccr.sourceforge.net |