今天把拆分好好的了解了一下。我的首选是先1行1列,然后再分别拆开左边和右边,我需要的是2行2列任意拖拽。然后在里面添加view
if(m_wndSplitter1.CreateStatic(this,1,2)==NULL)
return FALSE;
m_wndSplitter1.SetColumnInfo(0, 200 , 100);
//m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(Cmview),CSize(150,200), pContext);
//m_wndSplitter1.CreateView(1,0,RUNTIME_CLASS(Cmview),CSize(110,110),pContext);
if(m_wndSplitter2.CreateStatic(&m_wndSplitter1,2,1,WS_CHILD|WS_VISIBLE, m_wndSplitter1.IdFromRowCol(0,1))==NULL)
return FALSE;
m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(MyListView),CSize(500,500),pContext);
m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(MyView),CSize(500,500),pContext);
if(m_wndSplitter3.CreateStatic(&m_wndSplitter1,2,1,WS_CHILD|WS_VISIBLE, m_wndSplitter1.IdFromRowCol(0,0))==NULL)
return FALSE;
m_wndSplitter3.CreateView(0,0,RUNTIME_CLASS(MyTreeView),CSize(500,600),pContext);
m_wndSplitter3.CreateView(1,0,RUNTIME_CLASS(MyView),CSize(500,300),pContext);
return TRUE;
这样很难看,因为没给分开后的窗口没给添加大小/
分别添加treeview和listview
//获取主窗口
CMainFrame* pFrame=static_cast<CMainFrame*>(AfxGetMainWnd());
//获取某个view
CMyTreeView* pView=static_cast<CMyTreeView*>(pFrame->m_wndTopSplitter.GetPane(0,0));
//激活View
pFrame->SetActiveView(pView);
pFrame->m_wndTopSplitter.RecalcLayout();
//想干什么就干什么
pView->XXXXXX();
pView->SendMessage(WM_PAINT);
通过以上代码我们就可以在各个view间互相通信了