在MFC主框架視窗中分割視窗
阿新 • • 發佈:2019-01-27
1.過載這個函式 OnCreateClient(ctrl+w開啟類嚮導,新增CreatClient訊息)
2.CMyView 繼承一個civew類
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 在此新增專用程式碼和/或呼叫基類
m_splitterWnd.CreateStatic(this,1,3);
m_splitterWnd.CreateView(0,0,RUNTIME_CLASS(CMyView),CSize(100,100),pContext);
m_splitterWnd.CreateView (0,2,RUNTIME_CLASS(CMyFormView),CSize(100,100),pContext);
m_splitterWnd.CreateView(0,1,RUNTIME_CLASS(CMyEditView),CSize(100,100),pContext);
//m_splitter2.CreateStatic(&m_splitterWnd,0,1,WS_CHILD|WS_VISIBLE,m_splitterWnd.IdFromRowCol(0,1));
//m_splitter2.CreateView(0,0,RUNTIME_CLASS(CMyEditView),CSize(100,100),pContext);
return TRUE;
//return CFrameWnd::OnCreateClient(lpcs, pContext);
}