Name
Screen
Synopsis
This class allows you to enumerate the various displays attached to a system.
There are a number of static properties and methods.
AllScreens
returns an array of
Screen
objects, one for each attached display.
PrimaryScreen
gets the primary display.
FromPoint()
finds the display that contains a
specified point, while FromControl()
and
FromRectangle()
find the display that contains
the majority of the specified object. GetBounds()
and GetWorkingArea()
return the total bounds and
desktop area (respectively) of the display containing the specified
Control
.
For a particular Screen
object, the
Bounds
property returns the total area of the
display, and the WorkingArea
returns the desktop
bounds (i.e., excluding such things as taskbars, toolbars, etc.). The
Primary
property specifies whether it is the
primary display, and the DeviceName
returns the
name associated with the display.
public class Screen { // Public Static Properties public static Screen[ ] AllScreens{get; } public static Screen PrimaryScreen{get; } // Public Instance Properties public Rectangle Bounds{get; } public string DeviceName{get; } public bool Primary{get; } public Rectangle WorkingArea{get; } // Public Static Methods public static Screen FromControl(Control control); public static Screen FromHandle(IntPtr hwnd); public static Screen FromPoint(System.Drawing.Point point); public static Screen FromRectangle(System.Drawing.Rectangle rect); public static Rectangle GetBounds(Control ctl); public static ...
Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.