关于工具栏的位置

caimps 2007-07-06 10:14:16
多文档程序
在两个视图间切换是我让部分工具栏隐藏
切换回来时工具栏也重新显示
使用的showwindow

问题:
工具栏隐藏后在对应位置上留有空地
怎样让下面的工作区自动对上去

谢谢
...全文
567 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
cleverwyq 2007-07-06
  • 打赏
  • 举报
回复
CFrameWnd::RecalcLayout See Also
CFrameWnd Overview | Class Members | Hierarchy Chart | CWnd::RepositionBars
Called by the framework when the standard control bars are toggled on or off or when the frame window is resized.

virtual void RecalcLayout(
BOOL bNotify = TRUE
);
Parameters
bNotify
Determines whether the active in-place item for the frame window receives notification of the layout change. If TRUE, the item is notified; otherwise FALSE.
lyg_zy 2007-07-06
  • 打赏
  • 举报
回复

CRect rcDock=CRect( 0, 0, 0, 0 );
if( pBarPre )
{
pBarPre->GetDockingFrame()->RecalcLayout();
pBarPre->GetWindowRect( rcDock );
rcDock.OffsetRect( 1, 1 );
if( bNextRow )
{
rcDock.left=0;
rcDock.top +=rcDock. Height();

}
}
pMainFrame->DockControlBar( pBar, nDockBarID, rcDock );


以上代码解释:
bNextRow:true
pBar在pBarPre的下一行停靠,

bNextRow:false
pBar在pBarPre的右边停靠,右边无空间装下,则自动换到下一行。


回风舞雪 2007-07-06
  • 打赏
  • 举报
回复
比如:隐藏主框架窗口中的工具栏,
可以在MainFrm中的OnCreate函数中添加:

ShowControlBar(&m_wndToolBar,FALSE,FALSE);
RecalcLayout();
回风舞雪 2007-07-06
  • 打赏
  • 举报
回复
可以用CFrameWnd::ShowControlBar( CControlBar* pBar, BOOL bShow, BOOL bDelay );来控制工具栏的显示/隐藏

用CFrameWnd::RecalcLayout( BOOL bNotify = TRUE );来控制工具栏的重新布置,来达到你“工具栏隐藏后在对应位置上留有空地
怎样让下面的工作区自动对上去”
的目的
wode2009 2007-07-06
  • 打赏
  • 举报
回复
如果你看一看《visual c++ mfc扩展编程实例》这本书,一定能解决这个问题。

15,980

社区成员

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

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