Struct screen
Represents a screen device. Gets its rectangle etc.
public struct screen : IEquatable<screen>
Remarks
A computer can have one or more screens (aka display devices, monitors). One of them is the primary screen; its top-left coordinate is 0 0. To show or find a window or some object in a particular screen, need to identify the screen somehow. At Windows API level each screen has a unique integer identifier, known as screen handle or HMONITOR. But it is a random variable value and therefore cannot be specified directly in script etc. Instead can be used screen index or some object on that screen (window, point, rectangle).
A screen variable can contain either a screen handle or a callback function that returns a screen handle. If empty, most functions interpret it as the primary screen.
To create screen variables use static functions (like screen.index(1) or screen.primary) or constructors (like new screen(()=>screen.index(1))) or screen.at. Then call non-static functions to get screen properties.
A screen handle cannot be reliably used for a long time. Screen handles may change when changing the configuration of multiple screens. Consider a "lazy" variable, ie with callback function screen.LazyFunc. Then, whenever a function needs a screen handle, it calls the callback function which returns a screen with fresh handle.
Namespace: Au
Assembly: Au.dll
Constructors
| Name | Description |
|---|---|
| screen(Func<screen>) | Creates "lazy" variable that calls your function to get screen when need. |
| screen(nint) | Creates variable with screen handle, aka HMONITOR. |
Properties
| Name | Description |
|---|---|
| Dpi | Gets DPI of this screen. Calls Dpi.OfScreen. |
| Handle | Gets the screen handle, aka HMONITOR. Returns |
| Info | Gets screen rectangle and other info. |
| IsAlive | True if the screen handle is valid. |
| IsEmpty | Returns |
| LazyFunc | Gets the callback function that returns screen when need. Returns |
| Now | Returns a copy of this variable with screen.Handle. |
| Rect | Calls screen.Info and returns screen rectangle. |
| ScreenIndex | Gets index of this screen in the screen.all array. |
| WorkArea | Calls screen.Info and returns work area rectangle. |
| all | Gets all screens. |
| ofActiveWindow | Returns a lazy screen variable that later will get the screen of the active window at that time. |
| ofMouse | Returns a lazy screen variable that later will get the screen from the mouse cursor position at that time. |
| primary | Gets the primary screen. |
| virtualScreen | Gets bounding rectangle of all screens. |
Methods
| Name | Description |
|---|---|
| Equals(screen) | |
| Equals(object) | |
| GetHashCode() | |
| GetRect(bool) | Calls screen.Info and returns rectangle of the screen or its work area. |
| ToString() | |
| index(int, bool) | Gets screen at the specified index of the screen.all array. |
| isInAnyScreen(POINT) | Returns |
| isInAnyScreen(RECT) | Returns |
| isInAnyScreen(wnd) | Returns |
| of(POINT, SODefault, bool) | Gets screen containing the specified point or nearest to it. |
| of(RECT, SODefault, bool) | Gets screen containing the biggest part of the specified rectangle or nearest to it. |
| of(wnd, SODefault, bool) | Gets screen containing the biggest part of the specified window or nearest to it. |
| of(wndFinder, SODefault, bool) | Gets screen containing the biggest part of the specified window or nearest to it. |
| of(int, int, SODefault, bool) | Gets screen containing the specified point or nearest to it. |
| of(Control, SODefault, bool) | Gets screen containing the biggest part of the specified winforms window or control or nearest to it. |
| of(FrameworkElement, SODefault, bool) | Gets screen containing the biggest part of the specified WPF element (of its rectangle) or nearest to it. |
| of(Window, SODefault, bool) | Gets screen containing the biggest part of the specified WPF window or nearest to it. |
Operators
| Name | Description |
|---|---|
| operator ==(screen, screen) | |
| operator !=(screen, screen) |