MFC Toolbar on Dialog?(对话框上的 MFC 工具栏?)
问题描述
我已经尝试了所有我能想到的方法来让工具栏显示在我的对话框中...包括尝试使用 CreateWindow 自己创建它...但它不会显示
I have tried everything I can think of to get a toolbar to show up on my dialog... including trying to create it myself with CreateWindow.. but it won't show up
我在资源编辑器中创建了一个对话框,然后为它创建了一个类(尝试从 CDialog 和 CDialogEx 派生).不可以加个CToolbar控件吗?
I created a dialog in the resource editor, and then made a class for it(tried deriving from both CDialog and CDialogEx). Isn't it possible to add a CToolbar control to it?
推荐答案
嗯,有四个步骤.
1、CToolBar m_ToolBar;//同时你创建一个资源(例如 IDR_TOOLBAR1)
2、调用CToolBar的Create函数
2, Call CToolBar's Create function
m_ToolBar.Create(this);
3、调用LoadToolBar函数
3, Call the LoadToolBar function
m_ToolBar.LoadToolBar(IDR_TOOLBAR1);
4、最重要的一步,调用RepositionBars
4, The most important step, call RepositionBars
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
这篇关于对话框上的 MFC 工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:对话框上的 MFC 工具栏?
基础教程推荐
- 为什么我们不能使用“虚拟继承"?在 COM 中? 2022-01-01
- 提升 ASIO 流缓冲 2021-01-01
- 与 CAS 的原子交换(使用 gcc 同步内置函数) 2022-01-01
- c++ STL设置差异 2022-01-01
- 如何更改 SysDateTimePick32 或 CDateTimeCtrl 的背景颜色? 2022-01-01
- 将不可复制的闭包对象传递给 std::function 参数 2021-01-01
- 如何部分禁用 cmake C/C++ 自定义编译器检查 2021-01-01
- C++:获取传递给函数的多维数组的行大小 2021-01-01
- 如何在 C++ 中正确使用命名空间? 2022-01-01
- 随机插入/删除的综合向量与链表基准 2022-01-01
