Hi Experts:
Using C#, is there a way to get the display monitor's size in inches (for
example, I'd like to know if the monitor size is 15", 17" or whatever)?
Thanks in Advance
Polaris
Paul E Collins - 31 Mar 2008 01:53 GMT
> Using C#, is there a way to get the display monitor's size in inches
> (for example, I'd like to know if the monitor size is 15", 17" or
> whatever)?
SystemInformation.PrimaryMonitorSize will give you the size in pixels
(screen dots).
If you really need it in inches, you can't do it in .NET, but I think
you could use a Win32 API call to GetDeviceCaps.
Eq.
Cowboy (Gregory A. Beamer) - 31 Mar 2008 03:06 GMT
No guaranteed way to get inches, even what Paul has suggested, as it is not
a required component of the interface between the monitor and Windows. You
can, as Paul has stated, get resolution.

Signature
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss
or just read it:
http://gregorybeamer.spaces.live.com/
*************************************************
| Think outside the box!
*************************************************
> Hi Experts:
>
[quoted text clipped - 3 lines]
> Thanks in Advance
> Polaris
Fred Mellender - 31 Mar 2008 16:17 GMT
Once you have the monitor size in pixels
(SystemInformation.PrimaryMonitorSize),
you can get the dpi by creating a Graphics (g) and getting the Horizontal
and Vertical pitch via g.DpiX, g.DpiY. Then you should be able to get the
monitor size in inches via division of the PMS by the pitch.
I haven't tried this, but it seems reasonable to me.
> Hi Experts:
>
[quoted text clipped - 3 lines]
> Thanks in Advance
> Polaris
Polaris - 31 Mar 2008 22:49 GMT
Thanks. I tried that also, but the DpiX/DpiY didi not change when I change
the monitor resolution. Looks like they represent native resolutions only.
> Once you have the monitor size in pixels
> (SystemInformation.PrimaryMonitorSize),
[quoted text clipped - 11 lines]
>> Thanks in Advance
>> Polaris