問題描述
我必須創建一個基于對話框的應用程序,而不是舊的 CFormView 類型的設計.但是 CDialog 生成固定大小的對話框.如何使用可調整大小的對話框創建基于對話框的應用程序?
I have to create a dialog based application, instead of old CFormView type of design. But CDialog produces fixed-size dialogs. How can I create dialog based applications with resizable dialogs?
推薦答案
在 RC 資源文件中,如果對話框有類似這樣的樣式,它將是固定大小的:
In the RC resource file if the dialog has this style similar to this it will be fixed size:
IDD_DIALOG_DIALOG DIALOGEX 0, 0, 320, 201
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
如果對話框有這種風格,它會很大:
If the dialog has this style it will be sizeable:
IDD_DIALOG_DIALOG DIALOGEX 0, 0, 320, 201
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
使用這些可調整大小的框架選項,對話框將可以重新調整大小,但您仍需要做大量工作來處理 WM_SIZE 消息,以管理對話框中控件的大小和位置.
With these sizable frame options the dialog will be re-sizeable but you will still need to do a lot of work handling the WM_SIZE message to manage the sizing an positioning of the controls within the dialog.
這篇關于如何在 MFC 中創建可調整大小的 CDialog?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!