To get number and informations of all monitors in C# and VB.NET you can use the following snippet.
Sample C#
for (int index = 0; index < Screen.AllScreens.Length; index++) { var screen = Screen.AllScreens[index]; Console.WriteLine("Name: {0}", screen.DeviceName); Console.WriteLine("Bounds: {0}", screen.Bounds); Console.WriteLine("Working Area: {0}", screen.WorkingArea); Console.WriteLine("Primary Screen: {0}", screen.Primary); Console.WriteLine("Type: {0}", screen.GetType()); }
Sample VB.NET
For index As Integer = 0 To Screen.AllScreens.Length - 1 Dim screen__1 = Screen.AllScreens(index) Console.WriteLine("Name: {0}", screen__1.DeviceName) Console.WriteLine("Bounds: {0}", screen__1.Bounds) Console.WriteLine("Working Area: {0}", screen__1.WorkingArea) Console.WriteLine("Primary Screen: {0}", screen__1.Primary) Console.WriteLine("Type: {0}", screen__1.[GetType]()) Next
RT @CodeSnippetsNET: Get informations of monitors in .NET http://t.co/EIT9GbtA73 #csharp #vb #dotnet