Possible duplicate:
How to determine the true pixel size of my monitor in .NET?
How to get the size of a monitor I mean its physical size, like width and height and diagonal, for example, 17 inches or what
I do not need a resolution, I tried
using System.Management ; namespace testscreensize { class Program { static void Main(string[] args) { ManagementObjectSearcher searcher = new ManagementObjectSearcher("\\root\\wmi", "SELECT * FROM WmiMonitorBasicDisplayParams"); foreach (ManagementObject mo in searcher.Get()) { double width = (byte)mo["MaxHorizontalImageSize"] / 2.54; double height = (byte)mo["MaxVerticalImageSize"] / 2.54; double diagonal = Math.Sqrt(width * width + height * height); Console.WriteLine("Width {0:F2}, Height {1:F2} and Diagonal {2:F2} inches", width, height, diagonal); } Console.ReadKey(); } } }
he gives an error
Could not find type name or namespace 'ManagementObjectSearcher'
and it only works for Vista, I need a much wider solution
Also i tried
Screen.PrimaryScreen.Bounds.Height
but it returns permission
source share