如何让Dialog Bar位于Tool Bar的上头(Y坐标)

claider 2008-02-26 11:50:01
MDI应用中,如何把Dialog Bar放到ToolBar的下面(所谓上下,指的是Y坐标),我的那段代码如下:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;

if (!m_wndDlgBar.Create(this, IDD_DIALOGBAR,
CBRS_TOP |CBRS_TOOLTIPS|CBRS_FLYBY, IDD_DIALOGBAR))
{
TRACE0("Failed to create DlgBar\n");
return -1; // fail to create
}//here created the Dialog Bar!!!!!

if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}//here Created the tool bar!!!!

if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
/*
if (!m_wndDlgBar.Create(this, IDD_DIALOGBAR,
CBRS_TOP |CBRS_TOOLTIPS|CBRS_FLYBY, IDD_DIALOGBAR))
{
TRACE0("Failed to create DlgBar\n");
return -1; // fail to create
}
*/
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);

return 0;
}
...全文
72 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhoujianhei 2008-02-26
  • 打赏
  • 举报
回复
http://topic.csdn.net/t/20010402/23/91676.html
cnzdgs 2008-02-26
  • 打赏
  • 举报
回复
如果你只是简单地想要把DialogBar放上面,3楼的做法更合适。
claider 2008-02-26
  • 打赏
  • 举报
回复
搞定了,利用CReBar,赫赫,比上面那个链接做得好.
snowbirdfly 2008-02-26
  • 打赏
  • 举报
回复
可以参考一下:
http://www.codeproject.com/KB/toolbars/TabedReBar.aspx
jameshooo 2008-02-26
  • 打赏
  • 举报
回复
m_wndDlgBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndDlgBar);
DockControlBar(&m_wndToolBar);
cnzdgs 2008-02-26
  • 打赏
  • 举报
回复
一般用CReBar。

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧