DekGenius.com
[ Team LiB ] Previous Section Next Section

Screen

System.Windows.Forms (system.windows.forms.dll)class

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 Rectangle GetBounds(System.Drawing.Point pt);
   public static Rectangle GetBounds(System.Drawing.Rectangle rect);
   public static Rectangle GetWorkingArea(Control ctl);
   public static Rectangle GetWorkingArea(System.Drawing.Point pt);
   public static Rectangle GetWorkingArea(System.Drawing.Rectangle rect);
// Public Instance Methods
   public override bool Equals(object obj);  // overrides object
   public override int GetHashCode();  // overrides object
   public override string ToString();  // overrides object
}
    [ Team LiB ] Previous Section Next Section