对话框上的MFC工具栏? [英] MFC Toolbar on Dialog?
问题描述
我已经尽一切努力使工具栏显示在对话框中...包括尝试使用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; // Meanwhile you create a resource (e.g. 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工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!