Sets the bounds (Left, Top, Width, Height) of the control.
Source position: controls.pp line 1591
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, 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 .frm 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.
CT Web help |
CodeTyphon Studio |