视图分割代码:
首先重写虚函数OnCreateClient,重写其内容:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
m_wndSplitter1.CreateStatic(this,1,2);
m_wndSplitter3.CreateStatic(&m_wndSplitter1, 2, 1, WS_CHILD | WS_VISIBLE, m_wndSplitter1.IdFromRowCol(0,0));
// 分割左视图
m_wndSplitter3.CreateView(0, 0, RUNTIME_CLASS(CMyListView),CSize(250, 200), pContext);
m_wndSplitter3.CreateView(1, 0, RUNTIME_CLASS(CChatList),CSize(250, 0), pContext);
m_wndSplitter1.SetColumnInfo(0, 200, 150);
// 将右视图一分为二
m_wndSplitter2.CreateStatic(&m_wndSplitter1, 2, 1, WS_CHILD | WS_VISIBLE, m_wndSplitter1.IdFromRowCol(0,1));
// IdFromRowCol(0,1) 根据面板得到ID
m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CServer002View),CSize(0, 200), pContext);
m_wndSplitter2.CreateView(1, 0, RUNTIME_CLASS(CServer002View),CSize(0, 0), pContext);
return TRUE;
// return CFrameWnd::OnCreateClient(lpcs, pContext);
}