Düzenle

Aracılığıyla paylaş


MapDialogRect function (winuser.h)

Converts the specified dialog box units to screen units (pixels). The function replaces the coordinates in the specified RECT structure with the converted coordinates, which allows the structure to be used to create a dialog box or position a control within a dialog box.

Syntax

BOOL MapDialogRect(
  [in]      HWND   hDlg,
  [in, out] LPRECT lpRect
);

Parameters

[in] hDlg

Type: HWND

A handle to a dialog box. This function accepts only handles returned by one of the dialog box creation functions; handles for other windows are not valid.

[in, out] lpRect

Type: LPRECT

A pointer to a RECT structure that contains the dialog box coordinates to be converted.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The MapDialogRect function assumes that the initial coordinates in the RECT structure represent dialog box units. To convert these coordinates from dialog box units to pixels, the function retrieves the current horizontal and vertical base units for the dialog box, then applies the following formulas:


left   = MulDiv(left,   baseunitX, 4);
right  = MulDiv(right,  baseunitX, 4);
top    = MulDiv(top,    baseunitY, 8);
bottom = MulDiv(bottom, baseunitY, 8);

If the dialog box template has the DS_SETFONT or DS_SHELLFONT style, the base units are the average width and height, in pixels, of the characters in the font specified by the template.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-dialogbox-l1-1-2 (introduced in Windows 10, version 10.0.10240)

See also

Conceptual

Dialog Boxes

GetDialogBaseUnits

Other Resources

RECT

Reference