//声明一个分割对象
CSplitterWnd m_wndSplitter;
//在CMainFrame.cpp中重载函数OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
//代码当中的CMedicTreeView和CMedicListView是继承CView的类
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 在此添加专用代码和/或调用基类
//创建一个静态分栏窗口,分为1行2列
if (m_wndSplitter.CreateStatic(this,1,2)==NULL)
{
return FALSE;
}
CRect rect;
GetClientRect(&rect);
//将CMedicTreeView连接到0行0列窗格上
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CMedicTreeView),CSize(rect.Width()*2/5,rect.Height()),pContext);
//将CMedicListView连接到0行1列窗格上
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CMedicListView),CSize(rect.Width()*3/5,rect.Height()),pContext);
return TRUE;
//return CFrameWndEx::OnCreateClient(lpcs, pContext);
}