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 */;
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | System.Types.pas System.Types.hpp |
System.Types | System.Types |
説明
類似した別の四角形の中心に配置された TRect インスタンスまたは TRectF インスタンスを返します。
R
は初期の四角形を表します。Bounds
の中心は、R
を幅も高さも変更せずに配置する位置を示します。
例
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;
}