标签:头文件 this stat ext 文档 formview pil spec 获取
用VS08程序向导,单文档程序,默认设置生成的。工程名为3view;
其中默认生成的视图类CMy3viewView,对应3viewView.h,3viewView.cpp;
默认生成的文档类为:3viewDoc.h,3viewDoc.cpp;
在主框架头文件MainFrm.h中添加如下头文件; //为了后面好创建程序默认的视CMy3viewView;
#include "3viewDoc.h"
#include "3viewView.h"
并添加如下变量
CSplitterWnd m_wndSplitter;
CSplitterWnd m_wndSPlitterTB;
CSplitterWnd m_wndSPlitterTB2;
并重载OnCreateClient函数
1 BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 2 { 3 // TODO: Add your specialized code here and/or call the base class 4 CRect ct; 5 GetClientRect(&ct); 6 m_wndSplitter.CreateStatic(this,1,3); //主框架左右分成1行3列 7 8 m_wndSPlitterTB.CreateStatic(&m_wndSplitter,2,1,WS_CHILD|WS_VISIBLE,m_wndSplitter.IdFromRowCol(0,0)); //在m_wndSplitter的第1行第1列分割区成2行1列 9 m_wndSPlitterTB2.CreateStatic(&m_wndSplitter,3,1,WS_CHILD|WS_VISIBLE,m_wndSplitter.IdFromRowCol(0,1)); //在m_wndSplitter的第1行第2列分割区成2行1列 10 11 m_wndSPlitterTB.CreateView(0,0,RUNTIME_CLASS(CDefFormView),CSize(ct.Width()/3,ct.Height()/2),pContext); //在m_wndSPlitterTB中创建第1行第1列视图 12 m_wndSPlitterTB.CreateView(1,0,RUNTIME_CLASS(CDefFormView),CSize(ct.Width()/3,ct.Height()/2),pContext); //在m_wndSPlitterTB中创建第2行第1列视图 13 14 m_wndSPlitterTB2.CreateView(0,0,RUNTIME_CLASS(CDefFormView),CSize(ct.Width()/3,ct.Height()/3),pContext); //在m_wndSPlitterTB2中创建第1行第1列视图 15 m_wndSPlitterTB2.CreateView(1,0,RUNTIME_CLASS(CMy3viewView),CSize(ct.Width()/3,ct.Height()/3),pContext); //在m_wndSPlitterTB2中创建第2行第1列视图 16 m_wndSPlitterTB2.CreateView(2,0,RUNTIME_CLASS(CDefFormView),CSize(ct.Width()/3,ct.Height()/3),pContext); //在m_wndSPlitterTB2中创建第3行第1列视图 17 18 m_wndSplitter.CreateView(0,2,RUNTIME_CLASS(CMy3viewView),CSize(ct.Width()/3,0),pContext); //创建主框架第1行第3列的视图 19 20 //获取对应视图的对象 21 CMy3viewView* view = (CMy3viewView *)m_wndSplitter.GetPane(0,2); 22 CDefFormView* view2 = (CDefFormView*)m_wndSPlitterTB.GetPane(0,0); 23 24 m_is_spilit = TRUE; 25 return TRUE; 26 //return CFrameWnd::OnCreateClient(lpcs, pContext); 27 }
标签:头文件 this stat ext 文档 formview pil spec 获取
原文地址:http://www.cnblogs.com/touch-skyer/p/6385830.html