MFC toolbar on dialog?

I tried everything I could think of so that the toolbar would appear in my dialog box ... including trying to create it myself using CreateWindow .. but it would not be displayed

I created a dialog box in the resource editor and then created a class for it (it came from CDialog and CDialogEx). Is it not possible to add a CToolbar control to it?

+4
source share
1 answer

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 the CToolBar Create function

 m_ToolBar.Create(this); 

3, call the function LoadToolBar

 m_ToolBar.LoadToolBar(IDR_TOOLBAR1); 

4. The most important step is to call RepositionBars

 RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); 
+11
source

All Articles