CToolBar and CToolBarCtrl 区别

1. csdn的解释:

CToolBar
  工具栏窗口,要挂在框架类CFrameWnd上  每个CToolBar都包含一个CToolBarCtrl  可以通过GetToolBarCtrl()得到控件指针

CToolBarCtrl
  就是一个含有多个按钮的通用控件  一般是包含于CToolBar中的


2. http://forums.codeguru.com/showthread.php?143248-CToolBar-and-CToolBarCtrl 解释

the following is just excerpted from the MSDN Library:


'Objects of the class CToolBar are control bars that have a row of bitmapped buttons and optional separators. The buttons can act like pushbuttons, check-box buttons, or radio buttons. CToolBar objects are usually embedded members of frame-window objects derived from the class CFrameWnd or CMDIFrameWnd.

CToolBar::GetToolBarCtrl, a member function new to MFC 4.0, allows you to take advantage of the Windows common control's support for toolbar customization and additional functionality. CToolBar member functions give you most of the functionality of the Windows common controls; however, when you call GetToolBarCtrl, you can give your toolbars even more of the characteristics of Windows 95 toolbars. When you call GetToolBarCtrl, it will return a reference to a CToolBarCtrl object. See CToolBarCtrl for more information about designing toolbars using Windows common controls. For more general information about common controls, seeCommon Controls in the Windows 95 SDK Programmer’s Reference.'

From what I can tell CToolBar is just a wrapper class for CToolBarCtrl to make it simpler to use. If you want to do more complicated stuff then you would use CToolBarCtrl which can be obtained from the CToolBar::GetToolBarCtrl() or if you can be bothered you can just use CToolBarCtrl on its own.


我的感觉。ctoolbar比较容易用,选项少。继承关系 cwnd-->ccontrolbar-->ctoobar  ,所以有很多控件的特性。

ctoobarctrl 功能强,选项多。继承关系 cwnd-->ctoobarctrl 



你可能感兴趣的:(CToolBar and CToolBarCtrl 区别)