MFC Toolbar on Dialog?

懵懂的女人 提交于 2020-01-01 03:28:11

问题


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

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:


Well, there are four steps.

1, CToolBar m_ToolBar; // Meanwhile you create a resource (e.g. IDR_TOOLBAR1)

2, Call CToolBar's Create function

m_ToolBar.Create(this);

3, Call the LoadToolBar function

m_ToolBar.LoadToolBar(IDR_TOOLBAR1);

4, The most important step, call RepositionBars

RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);


来源:https://stackoverflow.com/questions/6448702/mfc-toolbar-on-dialog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!