BOOL CMyFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs,CCreateContext* pContext){ #if 0 // 创建动态切分窗口 //1 指定所需要的视图类 CCreateContext cxt; cxt.m_pNewViewClass = RUNTIME_CLASS(CMyView); //2 创建动态切分 m_wndSplit.Create(this,2,2,CSize(200,200),&cxt); #else //静态切分窗口的创建 //1 创建静态切分 m_wndSplit.CreateStatic(this,2,1); //这里最后参数填写的是默认id,即充满与客户区窗口 m_wndSplit.CreateView(0,0,RUNTIME_CLASS(CHtmlView),CSize(200,200),pContext); // m_wndSplit.CreateView(1,0,RUNTIME_CLASS(CHtmlView),CSize(200,200),pContext); m_wndSplit2.CreateStatic(&m_wndSplit,1,2,WS_CHILD|WS_VISIBLE, m_wndSplit.IdFromRowCol(1,0)); m_wndSplit2.CreateView(0,0,RUNTIME_CLASS(CMyView),CSize(100,100),pContext); m_wndSplit2.CreateView(0,1,RUNTIME_CLASS(CMyView),CSize(100,100),pContext); m_wndSplit2.SetColumnInfo(0,200,10); /* for(int i=0;i<3;++i){ for(int j=0;j<3;++j) m_wndSplit.CreateView(i,j,RUNTIME_CLASS(CEditView),CSize(200,200),pContext); } */ //2 获取创建好的视图 CHtmlView* pHtmlView = (CHtmlView*) m_wndSplit.GetPane(0,0); pHtmlView -> Navigate("D:/"); #endif return true; }
BOOL CMyFrameWnd::OnCreateClient( LPCREATESTRUCT lpcs,CCreateContext* pContext) { CCreateContext cct; cct.m_pNewViewClass = RUNTIME_CLASS(CMyView); split1.Create(this,2,2,CSize(100,100),&cct); return TRUE; /* 静态切分 split1.CreateStatic(this,1,2); split2.CreateStatic(&split1,2,1,WS_CHILD|WS_VISIBLE, split1.IdFromRowCol(0,0)); split2.CreateView(1,0,RUNTIME_CLASS(CMyView), CSize(100,100),pContext); split2.CreateView(0,0,RUNTIME_CLASS(CEditView), CSize(100,100),pContext); split1.CreateView(0,1,RUNTIME_CLASS(CHtmlView), CSize(100,100),pContext); CHtmlView*pView = (CHtmlView*)split1.GetPane(0,1); pView->Navigate("sina.com.cn"); split1.SetColumnInfo(0,200,100); return TRUE;//为何不调父类虚函数 */ }