INF: Translating Dialog-Box Size Units to Screen Units

ID Number: Q74280

3.00 3.10

WINDOWS

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:

1. 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).

2. 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 reference words: 3.00 3.10