为什么窗口还原时会缩成一个标题栏??

rib06 2006-04-22 06:52:16
我的程序中是1文档3视图结构,我想实现当主窗口框架大小改变时,三个子视图会自适应缩放,但是这段代码却出现问题:只有在窗口最大化时是正常的,而在还原时会缩成了一个标题栏,而且在托拽改变主窗口大小时,每个子视图的工具栏会有时消失有时出现。请问高手应该怎么实现这种子窗口自适应缩放的功能?谢谢!!
void CMainFrame::RecalcLayout(BOOL bNotify)
{
// TODO: Add your specialized code here and/or call the base class
if (m_bInRecalcLayout)
return;
m_bInRecalcLayout = TRUE;

CRect rect;
GetClientRect(&rect);

CRect rect1;
rect1.left=rect.left;
rect1.right=rect.right/2;
rect1.top=rect.top;
rect1.bottom=(rect.bottom+rect.top)/2;
CMDIChildWnd* pChild=(CMDIChildWnd*)GetActiveFrame();
if(::IsWindow(pChild->m_hWnd))
pChild->MoveWindow(&rect1);

CRect rect2;
rect2.left=rect.right/2;
rect2.right=rect.right;
rect2.top=rect.top;
rect2.bottom=(rect.bottom+rect.top)/2;
MDINext();
pChild=(CMDIChildWnd*)GetActiveFrame();
if(::IsWindow(pChild->m_hWnd))
pChild->MoveWindow(&rect2);

CRect rect3;
rect3.left=rect.left;
rect3.right=rect.right;
rect3.top=(rect.bottom+rect.top)/2;
rect3.bottom=rect.bottom-50;
MDINext();
pChild=(CMDIChildWnd*)GetActiveFrame();
if(::IsWindow(pChild->m_hWnd))
pChild->MoveWindow(&rect3);

RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposDefault, NULL,NULL);

m_bInRecalcLayout = FALSE;

CMDIFrameWnd::RecalcLayout(bNotify);
}
...全文
278 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
rib06 2006-07-28
  • 打赏
  • 举报
回复
无法解决,无奈结贴
hahanow 2006-04-25
  • 打赏
  • 举报
回复
不懂,帮顶!
rib06 2006-04-24
  • 打赏
  • 举报
回复
up
rib06 2006-04-23
  • 打赏
  • 举报
回复
Mackz说的没用啊!我放在前面还是一样的问题。
有知道的吗?
rib06 2006-04-23
  • 打赏
  • 举报
回复
尝试了把CMDIFrameWnd::RecalcLayout(bNotify);放到前面任意位置,都还是无效……

请高手指点
ftkghost 2006-04-22
  • 打赏
  • 举报
回复
学习
菜牛 2006-04-22
  • 打赏
  • 举报
回复
CMDIFrameWnd::RecalcLayout(bNotify);
放到前面去。
CUG122032 2006-04-22
  • 打赏
  • 举报
回复
SetWindowPos(...);

15,976

社区成员

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

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