HOWTO: Translate Dialog-Box Size Units to Screen Units
ID: Q74280
|
The information in this article applies to:
-
Microsoft Win32 Software Development Kit (SDK)
-
Microsoft Windows Software Development Kit (SDK) versions 3.0, 3.1
SUMMARY
In the Microsoft Windows graphical environment, the MapDialogRect
function converts dialog-box units to screen units easily.
MORE INFORMATION
When a application dynamically adds a child window to a dialog box, it
may be necessary to align the new control with other controls that
were defined in the dialog box's resource template in the RC file.
Because the dialog box template defines the size and position of a
controls in dialog-box units rather than in screen units (pixels), the
application must translate dialog-box units to screen units to align
the new child window.
An application can use the following two methods to translate dialog-
box units to screen units:
- The MapDialogRect function provides the easier method. This
function converts dialog-box units to screen units automatically.
For more details on this method, please see the documentation for
the MapDialogRect function in the Microsoft Windows Software
Development Kit (SDK).
- Use the GetDialogBaseUnits function to retrieve the size of the
dialog base units in pixels. A dialog unit in the x direction is
one-fourth of the width that GetDialogBaseUnits returns. A dialog
unit in the y direction is one-eighth of the height that the
function returns.
For more details on this method, see the documentation for the
GetDialogBaseUnits function in the Windows SDK.
Additional query words:
convert unit pixel
Keywords : kbDlg kbNTOS kbWinOS2000 kbSDKWin32 kbGrpUser kbWinOS
Version : WINDOWS:3.0,3.1
Platform : WINDOWS
Issue type : kbhowto