Getting PHYSICAL monitor size in C#

  • Thread starter Thread starter Valerie Hough
  • Start date Start date
V

Valerie Hough

Does anyone have an example of how to get the PHYSICAL monitor size in C#?

In C++ I used to use GetDeviceCaps( dc, HORZSIZE ) which returns the monitor
size in mm, then I
converted it to inches.

When I do this as unmanaged code in C#, I am getting back a value that show
my 19" monitor
has a width of only 12.9", whereas my trusty ruler shows it to be about
15.5".

Is this a driver problem, and if so, what am I to do?

Thanks in advance,
Chris Hough
 
Valerie said:
Is this a driver problem, and if so, what am I to do?

If it's a driver problem then your C++ program should have the same output.
as your C# program. Does it?
 
My C++ program does produce the same output.

I should have said in my original post that the monitor is a 21" (not 19")
Hitachi CM801, video card is NVIDIA RIVA TNT 2 Model 64, resolution set to
800x600.
 
Valerie said:
My C++ program does produce the same output.

I would be very doubtful you could rely on a function that returns a
monitor size, given that you don't know where windows is getting the
monitor size from. Windows has never asked me how big my monitor is...
There are monitor drivers, but how do you know you have the right one
installed (as you are finding out)?
 
gabriel said:
I would be very doubtful you could rely on a function that returns a
monitor size, given that you don't know where windows is getting the
monitor size from. Windows has never asked me how big my monitor is...
There are monitor drivers, but how do you know you have the right one
installed (as you are finding out)?

Exactly. The computer doesn't *know* the physical size of the monitor,
unless the driver *happens* to include that information. The computer
generates pixels, not inches, and without making any change in the computer,
you can plug in a different monitor and get the same picture, a different
size.
 
Back
Top