简体   繁体   中英

MFC Toolbar on Dialog?

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?

Well, there are four steps.

1, CToolBar m_ToolBar; // Meanwhile you create a resource (eg IDR_TOOLBAR1) CToolBar m_ToolBar; // Meanwhile you create a resource (eg 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM