多文档应用程序中改变视图的大小和位置!

来源:互联网 发布:网络平台制作软件 编辑:程序博客网 时间:2024/05/16 12:21

//1、得到父框架窗口的指针

CFrameWnd* pParentFrame=GetParentFrame();

ASSERT_VALID(pParentFrame);

 

 

//2、得到MDI Client 窗口的指针

CWnd* pMDIClient=pParentFrame->GetParent();

ASSERT_VALID(pMDIClient);

 

 

//3、计算MDI Client 窗口的尺寸

CRect rect;

pMDIClient->GetClientRect(&rect);

 

 

//4、移动视图的父框架窗口到预想的位置

pParentFrame->MoveWindow(rect.Width()/2,0,rect.Width()/2,rect.Height()/2);