简体   繁体   中英

Updating to MFC Feature Pack

I have several Toolbars/Menubars derived from the code Sizing Control Bar that I would like to be able to use with CFrameWndEx but I'm unable to find an easy to use the ShowPane functions with the CControlBar derived objects.

For instance with CFrameWnd :

ShowControlBar(&m_ctlDimBar, m_ctlDimBar.IsVisible(), FALSE);

Needs to be replaced, when using CFrameWndEx , with:

ShowPane(&m_ctlDimBar, m_ctlDimBar.IsVisible(), FALSE, TRUE);

Yet I can't use m_ctlDimBar as is because it is a CControlBar derived object and not a CBasePane object. Is there an easy way to circumvent the incompatibility without having to rewrite the code from the link?

CControlBar is the old world of toolbars, when you use the new MFC style you must use all components from the CMFC classes. Sadly not all of the new classes start with CMFC.

So if you have a CControlBar with some content that should be dockable use CDockingPane now.

CControlBar was the old base class for CToolBar and other.

The new classes are derived in this way: CMFCToolBar -< CMFCBaseToolBar -> CPane -> CWnd

CPane is the nearest baseclass for you and the CDockingPane is the window class that allows you to place your own content.

The easiest way to find out how this new stuff works is to create a sample application with the wizard. Than look at the base classes how the different kind of windows are implemented. The description is horrible and nearlynot existing. But usingthe code isn't so complicated. ;)

PS: After I wrote some comments I try an answer.

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