Screen Class
Represents a display device or multiple display devices on a single system.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The Screen type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | AllScreens | Gets an array of all displays on the system. |
![]() | BitsPerPixel | Gets the number of bits of memory, associated with one pixel of data. |
![]() | Bounds | Gets the bounds of the display. |
![]() | DeviceName | Gets the device name associated with a display. |
![]() | Primary | Gets a value indicating whether a particular display is the primary device. |
![]() ![]() | PrimaryScreen | Gets the primary display. |
![]() | WorkingArea | Gets the working area of the display. The working area is the desktop area of the display, excluding taskbars, docked windows, and docked tool bars. |
| Name | Description | |
|---|---|---|
![]() | Equals | Gets or sets a value indicating whether the specified object is equal to this Screen. (Overrides Object::Equals(Object).) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() | FromControl | Retrieves a Screen for the display that contains the largest portion of the specified control. |
![]() ![]() | FromHandle | Retrieves a Screen for the display that contains the largest portion of the object referred to by the specified handle. |
![]() ![]() | FromPoint | Retrieves a Screen for the display that contains the specified point. |
![]() ![]() | FromRectangle | Retrieves a Screen for the display that contains the largest portion of the rectangle. |
![]() ![]() | GetBounds(Control) | Retrieves the bounds of the display that contains the largest portion of the specified control. |
![]() ![]() | GetBounds(Point) | Retrieves the bounds of the display that contains the specified point. |
![]() ![]() | GetBounds(Rectangle) | Retrieves the bounds of the display that contains the largest portion of the specified rectangle. |
![]() | GetHashCode | Computes and retrieves a hash code for an object. (Overrides Object::GetHashCode().) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | GetWorkingArea(Control) | Retrieves the working area for the display that contains the largest region of the specified control. The working area is the desktop area of the display, excluding taskbars, docked windows, and docked tool bars. |
![]() ![]() | GetWorkingArea(Point) | Retrieves the working area closest to the specified point. The working area is the desktop area of the display, excluding taskbars, docked windows, and docked tool bars. |
![]() ![]() | GetWorkingArea(Rectangle) | Retrieves the working area for the display that contains the largest portion of the specified rectangle. The working area is the desktop area of the display, excluding taskbars, docked windows, and docked tool bars. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Retrieves a string representing this object. (Overrides Object::ToString().) |
The following code example shows how to use various methods and properties of the Screen class. The example calls the AllScreens property to retrieve an array of all the screens connected to the system. For each returned Screen, the example adds the device name, bounds, type, working area, and primary screen to a ListBox. To use the example, add a ListBox and a Button to a form, and then add a Click event handler for the button.
private: void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) { // For each screen, add the screen properties to a list box. for each (Screen^ screen in Screen::AllScreens) { listBox1->Items->Add( String::Concat("Device Name: ", screen->DeviceName)); listBox1->Items->Add( String::Concat("Bounds: ", screen->Bounds)); listBox1->Items->Add( String::Concat("Type: ", screen->GetType())); listBox1->Items->Add( String::Concat("Working Area: ", screen->WorkingArea)); listBox1->Items->Add( String::Concat("Primary Screen: ", screen->Primary)); } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
