开发者

How can I set the size of a Win32 dialog in pixels?

开发者 https://www.devze.com 2023-03-06 08:50 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号