我按照vckbase上的例子做了两个可停靠可改变大小的bar,我想让这两个bar一上一下排列在窗口的左侧,如下+----------------------------------------+
|Title |
|---------+------------------------------|
| | |
| Bar1 | |
| | |
|---------| |
| | |
| Bar2 | |
| | |
+---------+------------------------------+因此两个bar分别设置了CBRS_ALIGN_LEFT|CBRS_ALIGN_TOP和CBRS_ALIGN_LEFT|CBRS_ALIGN_BOTTOM属性,但排列的结果却是如下:+----------------------------------------+
|Title |
|---------+---------+--------------------|
| | | |
| Bar1 | Bar2 | |
| | | |
| | | |
| | | |
| | | |
| | | |
+---------+---------+--------------------+那我应该如何正确设置bar style和windows style才能满足我的要求呢?
|Title |
|---------+------------------------------|
| | |
| Bar1 | |
| | |
|---------| |
| | |
| Bar2 | |
| | |
+---------+------------------------------+因此两个bar分别设置了CBRS_ALIGN_LEFT|CBRS_ALIGN_TOP和CBRS_ALIGN_LEFT|CBRS_ALIGN_BOTTOM属性,但排列的结果却是如下:+----------------------------------------+
|Title |
|---------+---------+--------------------|
| | | |
| Bar1 | Bar2 | |
| | | |
| | | |
| | | |
| | | |
| | | |
+---------+---------+--------------------+那我应该如何正确设置bar style和windows style才能满足我的要求呢?
解决方案 »
- 一大早的问题???_vatiant_t和_bstr_t它们提供了通用的方法转换COM对象和C++类型的数据
- 哪位高人给个visual c++ 2003通过ado.net连接mysql数据库的代码
- 出钱求购一段代码
- 讨厌的老问题Combo box
- 如何用IWebBrowser->Navigate 模拟Form中向web服务器(aspx)post参数值?
- 怎样获取当前光标所在的编辑框的句柄
- 为何老是出错呢?窗口分割的问题!!
- 我想知道有没有关于游戏汉化方面的资料啊!!(急)!!!
- 如何由一个MSG* pMsg得到pMsg指向的消息的名称????
- MFC写读.hea文件的代码报错不会改了。求助大神!
- 在编写dll时碰到link警告,请问如何解决,详细内容请进....急!先谢谢各位了
- 如何修改可以运行
m_wndMyBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC然后用下面的语句设置停靠:
m_wndMyBar.EnableDocking(CBRS_ALIGN_LEFT);
DockControlBar(&m_wndMyBar,AFX_IDW_DOCKBAR_LEFT);两个bar都是这么设置的,如果想完成我的要求,应该如何修改相应的属性呢?
m_bar2.EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT);
改为CBRS_ALIGN_BOTTOM试试
m_bar2.EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT);
m_bar2.EnableDocking(CBRS_ALIGN_LEFT);
DockControlBar(&m_bar1, AFX_IDW_DOCKBAR_LEFT);
DockControlBar(&m_bar2, AFX_IDW_DOCKBAR_LEFT);可以达到你要的效果。
m_wndMyBar[0].EnableDocking(CBRS_ALIGN_ANY);
m_wndMyBar[1].EnableDocking(CBRS_ALIGN_ANY);DockControlBar(&m_wndMyBar[0], AFX_IDW_DOCKBAR_RIGHT);// dock mybar2 on the same row with mybar1
RecalcLayout();
CRect rBar;
m_wndMyBar[1].GetWindowRect(rBar);
rBar.OffsetRect(0, 1);
DockControlBar(&m_wndMyBar[1],AFX_IDW_DOCKBAR_RIGHT,rBar);
void g_DockControlBarOn(CFrameWnd*pFrame,CControlBar* pBarToDock,CControlBar* pBarOn,CSize sizeOffset)
{
CRect rect;
DWORD dw;
UINT n; // get MFC to adjust the dimensions of all docked ToolBars
// so that GetWindowRect will be accurate
pFrame->RecalcLayout();
pBarOn->GetWindowRect(&rect);
rect.OffsetRect(sizeOffset);
dw=pBarOn->GetBarStyle();
n = 0;
n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;
n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n;
n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n;
n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n; // When we take the default parameters on rect, DockControlBar will dock
// each Toolbar on a seperate line. By calculating a rectangle, we in effect
// are simulating a Toolbar being dragged to that location and docked.
pFrame->DockControlBar(pBarToDock,n,&rect);}
pcman1990,你有做好的例子么?mail给我好么?我的油箱是[email protected]。
DarkNighZZY,你的代码也不好用:(大家帮忙呀 :~(
pcman1990,你有做好的例子么?mail给我好么?我的油箱是[email protected]。
DarkNighZZY,你的代码也不好用:(大家帮忙呀 :~(