Screen Class
TOC
Collapse the table of content
Expand the table of content

Screen Class

 

Represents a display device or multiple display devices on a single system.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

System.Object
  System.Windows.Forms.Screen

public class Screen

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticAllScreens

Gets an array of all displays on the system.

System_CAPS_pubpropertyBitsPerPixel

Gets the number of bits of memory, associated with one pixel of data.

System_CAPS_pubpropertyBounds

Gets the bounds of the display.

System_CAPS_pubpropertyDeviceName

Gets the device name associated with a display.

System_CAPS_pubpropertyPrimary

Gets a value indicating whether a particular display is the primary device.

System_CAPS_pubpropertySystem_CAPS_staticPrimaryScreen

Gets the primary display.

System_CAPS_pubpropertyWorkingArea

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.

NameDescription
System_CAPS_pubmethodEquals(Object)

Gets or sets a value indicating whether the specified object is equal to this Screen.(Overrides Object.Equals(Object).)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticFromControl(Control)

Retrieves a Screen for the display that contains the largest portion of the specified control.

System_CAPS_pubmethodSystem_CAPS_staticFromHandle(IntPtr)

Retrieves a Screen for the display that contains the largest portion of the object referred to by the specified handle.

System_CAPS_pubmethodSystem_CAPS_staticFromPoint(Point)

Retrieves a Screen for the display that contains the specified point.

System_CAPS_pubmethodSystem_CAPS_staticFromRectangle(Rectangle)

Retrieves a Screen for the display that contains the largest portion of the rectangle.

System_CAPS_pubmethodSystem_CAPS_staticGetBounds(Control)

Retrieves the bounds of the display that contains the largest portion of the specified control.

System_CAPS_pubmethodSystem_CAPS_staticGetBounds(Point)

Retrieves the bounds of the display that contains the specified point.

System_CAPS_pubmethodSystem_CAPS_staticGetBounds(Rectangle)

Retrieves the bounds of the display that contains the largest portion of the specified rectangle.

System_CAPS_pubmethodGetHashCode()

Computes and retrieves a hash code for an object.(Overrides Object.GetHashCode().)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticGetWorkingArea(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.

System_CAPS_pubmethodSystem_CAPS_staticGetWorkingArea(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.

System_CAPS_pubmethodSystem_CAPS_staticGetWorkingArea(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.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Retrieves a string representing this object.(Overrides Object.ToString().)

The constructor for this object is not public, so you cannot explicitly create a Screen object. The object is created when you call its public methods.

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.
    foreach (var screen in System.Windows.Forms.Screen.AllScreens)
    {
        listBox1.Items.Add("Device Name: " + screen.DeviceName);
        listBox1.Items.Add("Bounds: " + 
            screen.Bounds.ToString());
        listBox1.Items.Add("Type: " + 
            screen.GetType().ToString());
        listBox1.Items.Add("Working Area: " + 
            screen.WorkingArea.ToString());
        listBox1.Items.Add("Primary Screen: " + 
            screen.Primary.ToString());
    }

}

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft