I am trying to get a Win32 dialog that is 500x520 px, but in my .rc file, these settings get me a bigger window than I expected.
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 500, 520
STYLE DS_MODAL开发者_JS百科FRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
Is there a scaling factor somewhere?
The units in a dialog resource are dialog units which are normalized by the dimensions of the dialog font by a rather convoluted process. You can convert from dialog units to screen pixels with MapDialogRect()
.
There are lots more details in the documentation for GetDialogBaseUnits()
but the recommended approach is to call MapDialogRect()
and let it do the hard work for you.
精彩评论