Vcl.Controls.TControl.BoundsRect

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property BoundsRect: TRect read GetBoundsRect write SetBoundsRect;

C++

__property System::Types::TRect BoundsRect = {read=GetBoundsRect, write=SetBoundsRect};

Properties

Type Visibility Source Unit Parent
property public
Vcl.Controls.pas
Vcl.Controls.hpp
Vcl.Controls TControl

Description

Specifies the bounding rectangle of the control, expressed in the coordinate system of the parent control.

Use BoundsRect as a quick way to obtain the pixel locations of all corners of the control all at once.

For example, the statement



R := Control.BoundsRect;



R = Control->BoundsRect;



corresponds to



R.Left := Control.Left;
R.Top := Control.Top;
R.Right := Control.Left + Control.Width;
R.Bottom := Control.Top + Control.Height;



R.Left = Control->Left;
R.Top = Control->Top;
R.Right = Control->Left + Control->Width;
R.Bottom = Control->Top + Control->Height;



The origin of the pixel coordinate system is in the upper-left corner of the parent window.

Note: A point is considered within the control's bounds rectangle if it lies on the left or top side but not if it lies on the right or bottom side. That is, to be inside the bounds rectangle, the x-coordinate must be greater than or equal to BoundsRect.Left and less than BoundsRect.Right, and the y-coordinate must be greater than or equal to BoundsRect.Top and less than BoundsRect.Bottom.

See Also

Code Examples