Possible Duplicate:
How do I determine the true pixel size of my Monitor in .NET?
How to get the monitor size I mean its physical size how width and height and diagonal for example 17 inch or what
I don't need the 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();
}
}
}
it give error
The type or namespace name 'ManagementObjectSearcher'
could not be found
and it works for vista only , I need much wider solution
also I tried
Screen.PrimaryScreen.Bounds.Height
but it return the resolution