Screen Class
Represents a display device or multiple display devices on a single system.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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 Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' For each screen, add the screen properties to a list box. For Each screen In System.Windows.Forms.Screen.AllScreens With ListBox1.Items .Add("Device Name: " + screen.DeviceName) .Add("Bounds: " + screen.Bounds.ToString()) .Add("Type: " + screen.GetType().ToString()) .Add("Working Area: " + screen.WorkingArea.ToString()) .Add("Primary Screen: " + screen.Primary.ToString()) End With Next End Sub
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.