如何在 MFC 中创建可调整大小的 CDialog? [英] How to create a resizable CDialog in MFC?

查看:25
本文介绍了如何在 MFC 中创建可调整大小的 CDialog?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须创建一个基于对话框的应用程序,而不是旧的 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆