MFC Dialog Size Question

2019-06-10 06:30发布

Good day.

from my vc++ project. .rc file.

IDD_My_DIALOG DIALOGEX 0, 0, 233, 273 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_OVERLAPPEDWINDOW | WS_EX_STATICEDGE | WS_EX_APPWINDOW CAPTION "AMEC FA Tool" FONT 8, "MS Shell Dlg", 0, 0, 0x1Q

How to change config a fixed dialog which size to length = 233 and hight = 273 ?

Any help will be appreciated.

BR! nano

标签: mfc dialog
1条回答
趁早两清
2楼-- · 2019-06-10 06:56

What is the question here? Dialog sizes are entered in DLU's, a unit to help with dealing with dialog in a resolution-independent way. If your question is how to display a dialog that is always the same size on the screen, regardless of resolution settings, the answer is 'don't', but if you still must, you'll have to fickle with GetDeviceCaps() and calculate physical->logical->device-dependent conversions. See for example http://msdn.microsoft.com/en-us/library/bb226789%28VS.85%29.aspx and search for DLU on this site.

If your question is how to make a dialog that is a certain amount of pixels high and wide regardless of resolution the answer is again 'don't' but if you really must, use GetDialogBaseUnits() and friends to calculate the right size (in pixels) in OnInitDialog().

If you're asking for something else completely, please rephrase your question.

查看更多
登录 后发表回答