想实现如下停靠工具栏的功能:
————————————————————————————————
| | |
|ControlBar1 | |
| | |
|——————— |
|ControlBar2 | |
| | |
| | |
| | |
|————————————————————————————————
但现在只能并列停靠在左边,而不能上下停靠在左边。
我通过这种方式实现停靠1.EnableDocking(CBRS_ALIGN_ANY); //每一个控件可以四边入。
2.m_ControlBar1.EnableDocking(CBRS_ALIGN_ANY); //把Bar1.控件可以四边入。
3.m_ControlBar2.EnableDocking(CBRS_ALIGN_ANY); //把bar2.控件可以四边入。
//两个条都入在左边。
//把左边的区域分为两个区域,一个区域给Bar1一个区域给Bar2。这样就行了。
CRect _Rect(0, 0, 200, 200);
DockControlBar(&m_wndMyBar1, AFX_IDW_DOCKBAR_LEFT, &_Rect);
_Rect.left = 0;
_Rect.top = 200;
_Rect.right = 200;
_Rect.bottom = 300;
DockControlBar(&m_wndMyBar2, AFX_IDW_DOCKBAR_LEFT, &_Rect);但是很不稳定,经过四五次正常的打开关闭运行后,工具栏又回到了左右并列的排列,再运行四五次又回到上下并列的位置。很是不解。请高手赐教!
————————————————————————————————
| | |
|ControlBar1 | |
| | |
|——————— |
|ControlBar2 | |
| | |
| | |
| | |
|————————————————————————————————
但现在只能并列停靠在左边,而不能上下停靠在左边。
我通过这种方式实现停靠1.EnableDocking(CBRS_ALIGN_ANY); //每一个控件可以四边入。
2.m_ControlBar1.EnableDocking(CBRS_ALIGN_ANY); //把Bar1.控件可以四边入。
3.m_ControlBar2.EnableDocking(CBRS_ALIGN_ANY); //把bar2.控件可以四边入。
//两个条都入在左边。
//把左边的区域分为两个区域,一个区域给Bar1一个区域给Bar2。这样就行了。
CRect _Rect(0, 0, 200, 200);
DockControlBar(&m_wndMyBar1, AFX_IDW_DOCKBAR_LEFT, &_Rect);
_Rect.left = 0;
_Rect.top = 200;
_Rect.right = 200;
_Rect.bottom = 300;
DockControlBar(&m_wndMyBar2, AFX_IDW_DOCKBAR_LEFT, &_Rect);但是很不稳定,经过四五次正常的打开关闭运行后,工具栏又回到了左右并列的排列,再运行四五次又回到上下并列的位置。很是不解。请高手赐教!
不过通常我都使用 BCGControlBar 或 XTreme ToolKit Pro 来完成
//设置左边两个工具栏停放位置
CRect _Rect(0, 0, 320, 200);
DockControlBar(&m_wndMyRegBar, AFX_IDW_DOCKBAR_LEFT, &_Rect);
_Rect.left = 0;
_Rect.top = 200;
_Rect.right = 320;
_Rect.bottom = 300;
DockControlBar(&m_wndStackMyBar, AFX_IDW_DOCKBAR_LEFT, &_Rect);
//设置右边四个工具栏停放位置
GetClientRect(&_Rect);
CRect _RectRight;
_RectRight.left = _Rect.right - 3020;
_RectRight.top = _Rect.top;
_RectRight.right = _Rect.right;
_RectRight.bottom = 200; DockControlBar(&m_wndMyRAMBarA, AFX_IDW_DOCKBAR_RIGHT, &_RectRight); _RectRight.left = _Rect.right - 320;
_RectRight.top = _Rect.top + 200;
_RectRight.right = _Rect.right;
_RectRight.bottom = 300;
DockControlBar(&m_wndMyRAMBarB, AFX_IDW_DOCKBAR_RIGHT, &_RectRight); _RectRight.left = _Rect.right - 320;
_RectRight.top = _Rect.top + 300;
_RectRight.right = _Rect.right;
_RectRight.bottom = 500;
DockControlBar(&m_wndMyRAMBarC, AFX_IDW_DOCKBAR_RIGHT, &_RectRight); _RectRight.left = _Rect.right - 320;
_RectRight.top = _Rect.top + 500;
_RectRight.right = _Rect.right;
_RectRight.bottom = 700;
DockControlBar(&m_wndMyRAMBarD, AFX_IDW_DOCKBAR_RIGHT, &_RectRight);