Conversion from millimeters to pixel without Win32 API

  • Thread starter Thread starter Laurent
  • Start date Start date
L

Laurent

Hi All

I tried to find in the framework .NET 2.0 (but non result) method or
property that can be used to convert millimeters to pixels depending on the
resolution of the screen.
I want to resize and position buttons on the screen at a fixed size given in
millimeters.
The dpiX and dpiY returns always 96 (or 120 depending on the display
properties).
I can compute a correct value using the API GetDeviceCaps but I would like
to use the framework and no call to Win32 API using platform invoke.

Anyone has an idea ?

Thanks
Laurent
 
Hello, Laurent:

There is no way to do that unless you know the exact dimensions of the monitor device you (or your costumer) are using.
For example, my 17" CRT is in fact less than 16" across, while my brother's 17" LCD is exactly 17". If we both use the same screen resolution, how could a program estimate the accurate measure of a millimeter? One solution could be that the manufacturers include that information, but they don't.
The only solution I see for you is that all the users use the custom resolution for the screen. In Windows XP it's in the display control panel, configuration, advanced, general tab. With it you can tell Windows what is the approximate resolution of each monitor.
It is a problem, because it affects all applications in the system...

Regards.


"Laurent" <[email protected]> escribió en el mensaje | Hi All
|
| I tried to find in the framework .NET 2.0 (but non result) method or
| property that can be used to convert millimeters to pixels depending on the
| resolution of the screen.
| I want to resize and position buttons on the screen at a fixed size given in
| millimeters.
| The dpiX and dpiY returns always 96 (or 120 depending on the display
| properties).
| I can compute a correct value using the API GetDeviceCaps but I would like
| to use the framework and no call to Win32 API using platform invoke.
|
| Anyone has an idea ?
|
| Thanks
| Laurent
 
Back
Top