FMX.Forms.TScreen.DisplayFromRect
Delphi
function DisplayFromRect(const Rect: TRect): TDisplay; overload;
function DisplayFromRect(const Rect: TRectF): TDisplay; overload;
C++
Fmx::Types::TDisplay __fastcall DisplayFromRect(const System::Types::TRect &Rect)/* overload */;
Fmx::Types::TDisplay __fastcall DisplayFromRect(const System::Types::TRectF &Rect)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | FMX.Forms.pas FMX.Forms.hpp |
FMX.Forms | TScreen |
Description
Returns the display having the nearest top-left corner from the center point of the specified Rect
rectangle.
DisplayFromRect returns the display whose work area's top-left corner is the nearest (in the virtual screen coordinates) to the center point of the specified Rect
rectangle.
The Rect
rectangle's center point coordinates are calculated using expressions like the following:
CentralPoint.X = (Rect
.Left +Rect
.Right)/2 CentralPoint.Y = (Rect
.Top +Rect
.Bottom)/2
The distance is calculated as the sum of absolute values of offsets between the Top and Left coordinates of a WorkArea and the correspondent X or Y coordinates of the specified Point
point. That is like:
Abs(WorkArea.Top-CentralPoint.Y) + Abs(WorkArea.Left-CentralPoint.X)
The virtual screen is the bounding rectangle of all displays used to comprise the desktop.