HOWTO: How to Make an Application Display Real Units of MeasurementID: Q127152
|
Sometimes you need an application to display things in terms of a real unit
of measurement such as an inch or millimeter. When dealing with a printer,
resolution is usually given in dots per inch (DPI), which makes it easy to
convert pixels to real inches. However, on a video display, resolution is
given only in pixels. A given video mode will be some X pixels wide with no
information as to the real dimensions of the display area.
Because there is no way to programmatically determine the real dimensions
of the viewable area on a video display, it is impossible for a program to
determine real output dimensions. Two manual methods for determining real
output dimensions are given in this article.
When output is destined for a printer, the application can call
GetDeviceCaps() using LOGPIXELSX and LOGPIXELSY to determine dots per real inch. However, for a video display, LOGPIXELSX and LOGPIXELSY are defined by the video driver and may vary wildly. These numbers define a logical inch, which is almost never equal to a real inch.
Applications that need to output real sizes to the video display can use
one of the following two methods for determining output size:
Additional query words: 3.10 4.00
Keywords : kbNTOS350 kbNTOS351 kbWinOS310 kbWinOS95 kbDSupport kbSDKWin16
Version : WINDOWS:3.1,95; winnt:3.5,3.51
Platform : WINDOWS winnt
Issue type : kbhowto
Last Reviewed: July 14, 1999