The information in this article applies to:
SUMMARYThis article demonstrates how to calculate the dialog base unit for the dialog box using a font other than System Font in Windows 95. You can use this calculation to build dialog box templates in memory or calculate dialog box dimensions. MORE INFORMATION
Each dialog box template contains measurements that specify the position,
width, and height of the dialog box and the controls it contains. These
measurements are device-independent, so an application can use a single
template to create the same dialog box for all types of display devices.
This ensures that a dialog box will have the same proportions and
appearance on all screens despite differing resolutions and aspect ratios
between screens.
As the font of a dialog box changes, the actual size and position of a
control also changes.
One dialog box base unit is equivalent to the number of pixels per dialog box unit as follows:
Average character width and height of a font can be computed as follows:
The tmAveCharWidth field of the TEXTMETRIC structure only approximates the
actual average character width (usually it gives the width of the letter
"x") and so the true average character width must be calculated to match
the value used by the system.
You can use the MapDialogRect function to convert dialog box units into pixels, but there is no function that will convert pixels into dialog box units. You can use the formulas shown here to perform this conversion. REFERENCESFor more information on this topic, please see the following article in the Microsoft Knowledge Base: HOWTO: Calculate Dialog Units When Not Using the System Font Additional query words:
Keywords : kbDlg kbWinOS2000 kbSDKWin32 kbGrpUser kbWinOS95 |
Last Reviewed: February 2, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |