2012年11月3日 星期六

Putting Controls On Toolbars

You can learn how to add combo box into toolbar by  http://msdn.microsoft.com/en-us/library/bb983718.aspx in the MFC project.

There is also the information in the http://msdn.microsoft.com/en-us/library/bb982770.aspx (
CMFCToolBarComboBoxButton Class).  It also show some code in the Visual Studio Demo sample of the MFC sample codes.  You can build the code and play it.

To add a combo box button to a toolbar, follow these steps:
1. Reserve a dummy resource ID for the button in the parent toolbar resource.
2. Construct a CMFCToolBarComboBoxButton object.
3. In the message handler that processes the AFX_WM_RESETTOOLBAR message, replace the dummy button with the new combo box button by usingCMFCToolBar::ReplaceButton.

But anyway, it can't work.  It take me several days to check this problem.  After all, I find we can add m_wndToolBar.ResetAll (); in the SHOWMESSAGE or SIZE message to solve this problem.

沒有留言:

張貼留言