System.Types.RectCenter
Delphi
function RectCenter(var R: TRect; const Bounds: TRect): TRect;
function RectCenter(var R: TRectF; const Bounds: TRectF): TRectF;
C++
extern DELPHI_PACKAGE TRect __fastcall RectCenter(TRect &R, const TRect &Bounds)/* overload */;
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Types.pas System.Types.hpp |
System.Types | System.Types |
Description
Returns an instance of TRect or TRectF placed in the center of another similar rectangle.
R
represents the initial rectangle. The center of Bounds
indicates the position where the center of R
will be placed, without changing its width or height.
Example
var
aRect: TRect;
bounds: TRect;
...
aRect:=TRect.Create(2,5,10,8);
bounds:=TRect.Create(10,15,15,40);
RectCenter(aRect, bounds);
{
New coordinates for aRect:
Left = 9;
Top = 26;
Right = 17;
Bottom = 29;
}