1.运行窗口的静态分割。
1.1.利用AppWizard创建一个单文档SDI应用程序,工程名为IntTranspSystem。由AppWizard生成的单文档工程自动生成的类有CAboutDlg,CIntTranspSystemApp,CIntTranspSystemDoc,CintTranspSystemView,CmainFrame。
1.2.新建基类为CEditView的视图类CbottomEditView。添加对话框资源,命名为IDD_LEFTDLG,设置对话框样式为child,边界设置为none。
并新建关于IDD_LEFTDLG的视图类CLeftDlgView,其基类为CformView。
1.3.在框架窗口类CmainFrame中声明两个CsplitterWnd类型的变量m_wndSplitter1 m_wndSplitter2。并在CintTranspSystemView .h中添加#include "IntTranspSystemDoc.h"的声明。
1.4在类MainFrame中重载OnCreateClient函数,实现窗口的切割,窗口分为两部分,左边为CLeftDlgView,右边分为上下两部分,上部分为CintTranspSystemView,下部分为CbottomEditView。
BOOLCMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
//TODO: Add your specialized code here and/or call the base class
CRectrect;
GetClientRect(&rect);
if(m_wndSplitter1.CreateStatic(this,1,2)==NULL)//1行2列
returnFALSE;
//第一次静态切分
m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CLeftDlgView),CSize(rect.Width()/4,rect.Height()),pContext); //0行0列显示对话框窗口
//第二次静态分割
if(m_wndSplitter2.CreateStatic(&m_wndSplitter1,2,1,WS_CHILD|WS_VISIBLE,
m_wndSplitter1.IdFromRowCol(0,1))==NULL)//在第一次分割基础上分割,分割成2行1列,分割点为0行1列位置
returnFALSE;
m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CIntTranspSystemView),CSize(rect.Width(),rect.Height()/5*4),pContext);//该分割点上0行0列位置显示System窗口
m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(CBottomEditView),CSize(1,1),pContext);//该分割点上1行0列位置显示Edit窗口
returnTRUE;//不再调用基类的OnCreateClient函数
//returnCFrameWnd::OnCreateClient(lpcs, pContext);
}
(窗口静态效果图)