Class Monitors
Information about monitors installed on the system.
Inherited Members
Namespace: OpenTK.Windowing.Desktop
Assembly: OpenTK.Windowing.Desktop.dll
Syntax
public static class Monitors
Properties
Count
The number of monitors available.
Declaration
[Obsolete("Use GetMonitors() instead.", true)]
public static int Count { get; }
Property Value
Type | Description |
---|---|
int |
Methods
BuildMonitorCache()
Builds the monitor cache (again if previously called).
Declaration
[Obsolete("There is no cache anymore", true)]
public static void BuildMonitorCache()
CheckCache()
Checks wheter the cache has been built or builds it if it can.
Declaration
[Obsolete("There is no cache anymore", true)]
public static bool CheckCache()
Returns
Type | Description |
---|---|
bool | Wether the current cache is valid or not. |
GetMonitorFromWindow(NativeWindow)
Find the monitor a window is in.
Declaration
public static MonitorInfo GetMonitorFromWindow(NativeWindow window)
Parameters
Type | Name | Description |
---|---|---|
NativeWindow | window | The window to find. |
Returns
Type | Description |
---|---|
MonitorInfo | The window the monitor was found in. |
Remarks
This function searches for the window by finding which monitor has the largest intersection area with the given monitor.
GetMonitorFromWindow(Window*)
Find the monitor a window is in.
Declaration
public static MonitorInfo GetMonitorFromWindow(Window* window)
Parameters
Type | Name | Description |
---|---|---|
Window* | window | The window to find. |
Returns
Type | Description |
---|---|
MonitorInfo | The window the monitor was found in. |
Remarks
This function searches for the window by finding which monitor has the largest intersection area with the given monitor.
GetMonitors()
Retrives a list of connected monitors.
Declaration
public static List<MonitorInfo> GetMonitors()
Returns
Type | Description |
---|---|
List<MonitorInfo> | A list of connected monitors. |
GetPlatformDefaultDpi()
Gets the default dpi for platforms.
Declaration
public static float GetPlatformDefaultDpi()
Returns
Type | Description |
---|---|
float | The platform default dpi. |
Remarks
For historical reasons macOS has a default dpi of 72, and other platforms have a default dpi of 96.
GetPrimaryMonitor()
Get the primary monitor. This is usually the monitor where elements like the task bar or global menu bar are located.
Declaration
public static MonitorInfo GetPrimaryMonitor()
Returns
Type | Description |
---|---|
MonitorInfo | The primary monitor. |
TryGetMonitorInfo(MonitorHandle, out MonitorInfo)
Try to get information about a monitor.
Declaration
[Obsolete("Use GetMonitors() instead.", true)]
public static bool TryGetMonitorInfo(MonitorHandle monitor, out MonitorInfo info)
Parameters
Type | Name | Description |
---|---|---|
MonitorHandle | monitor | The window handle. |
MonitorInfo | info | Monitor information. |
Returns
Type | Description |
---|---|
bool | True when the object was retrieved from cache, or built successfully. |
TryGetMonitorInfo(int, out MonitorInfo)
Try to get information about a monitor.
Declaration
[Obsolete("Use GetMonitors() instead.", true)]
public static bool TryGetMonitorInfo(int index, out MonitorInfo info)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the monitor. |
MonitorInfo | info | Monitor information. |
Returns
Type | Description |
---|---|
bool | True when the object was retrieved from cache, or built successfully. |
Events
OnMonitorConnected
Occurs when a MonitorHandle is connected or disconnected.
Declaration
public static event Action<MonitorEventArgs> OnMonitorConnected
Event Type
Type | Description |
---|---|
Action<MonitorEventArgs> |