为什么窗口还原时会缩成一个标题栏??
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);
}