如何在 MFC 中创建可调整大小的 CDialog?

2023-04-13C/C++开发问题
56

本文介绍了如何在 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么 C++ 不能从赋值推导出模板类型?
Why can#39;t C++ deduce template type from assignment?(为什么 C++ 不能从赋值推导出模板类型?)...
2024-08-14 C/C++开发问题
8

有状态函子 &STL:未定义的行为
Stateful functors amp; STL : Undefined behaviour(有状态函子 amp;STL:未定义的行为)...
2024-08-14 C/C++开发问题
9

你什么时候在 C++ 中使用函数对象?
When do you use function objects in C++?(你什么时候在 C++ 中使用函数对象?)...
2024-08-14 C/C++开发问题
8

插入 STL 映射是否会使其他现有迭代器无效?
Does insertion to STL map invalidate other existing iterator?(插入 STL 映射是否会使其他现有迭代器无效?)...
2024-08-14 C/C++开发问题
8