在mainFrm.cpp中
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
EnableDocking的作用是使工具栏能够停靠在窗体客户区的任何地方
其参数有:
CBRS_ALIGN_TOP Allows docking at the top of the client area.
CBRS_ALIGN_BOTTOM Allows docking at the bottom of the client area.
CBRS_ALIGN_LEFT Allows docking on the left side of the client area.
CBRS_ALIGN_RIGHT Allows docking on the right side of the client area.
CBRS_ALIGN_ANY Allows docking on any side of the client area.
CBRS_FLOAT_MULTI Allows multiple control bars to be floated in a single mini-frame window.
分别表示可以停靠的不同位置
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY)是先设置m_wndToolBar的停靠属性,默认的为任何位置
EnableDocking(CBRS_ALIGN_ANY)是设置窗体可以停靠的位置,但必须包括TOP,因为在DockControlBar(&m_wndToolBar)中
的默认设置是让m_wndToolBar停靠在TOP位置的,如果窗体不允许停靠的话,将会报错。
DockControlBar(&m_wndToolBar)是设置m_wndToolBar的初时停靠位置
void DockControlBar(
CControlBar* pBar,
UINT nDockBarID = 0,
LPCRECT lpRect = NULL
);