[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Forms' (#lcl)

TScreen.MonitorFromRect

Finds the monitor where the specified rectangle is located.

Declaration

Source position: forms.pp line 1261

public function TScreen.MonitorFromRect(

  const Rect: TRect;

  MonitorDefault: TMonitorDefaultTo = mdNearest

):TMonitor;

Arguments

Rect

  

Rectangle with the screen coordinates to locate in the method.

MonitorDefault

  

Monitor use when the specified rectangle is not found on a monitor.

Function result

The TMonitor instance where the rectangle is located.

Description

MonitorFromRect is a TMonitor function used to get the monitor where the coordinates in the specified rectangle are located.

MonitorDefault is a TMonitorDefaultTo enumeration value which indicates the monitor used when the coordinates in Rect are not found on a monitor. See TMonitorDefaultTo for more information about the values in the enumeration and their meanings.

MonitorFromRect calls the corresponding method in the widgetset class to get the Handle for the monitor where Rect is located. It searches Monitors for the TMonitor instance with the Handle value, and uses the TMonitor instance when the Handle is found. The UpdatedMonitor method is called to ensure that the value in Monitors are up-to-date.

When the Handle contains -1 (MONITOR_UNIMPL), the value in MonitorDefault us used to locate a monitor which intersects the coordinates in Rect. The return value is set to the TMonitor instance in Monitors which corresponds to the value in MonitorDefault. If a monitor is not found, the return value is set to PrimaryMonitor or the closest match as needed for MonitorDefault.

See also

TScreen.MonitorFromPoint

  

Finds the monitor containing the given screen coordinates.


Version 3.2 Generated 2024-02-25 Home