mfc 窗口 分割

 .h

protected:  // 控件条嵌入成员
 CStatusBar  m_wndStatusBar;
 CToolBar    m_wndToolBar;
 CSplitterWnd m_wndSplitter;//定义好分割变量

重写函数OnCreateClient(其中CMapLegend,CMapView已存在):

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
 if(!m_wndSplitter.CreateStatic(this,1,2))
 {
  TRACE0(_T("Failed to Splitter window\n"));
  return false;
 }

 if(!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CMapLegend),CSize(150,150),pContext))
 {
  TRACE0(_T("Failed to create second pane\n"));
  return false;
 }
 
 if(!m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CMapView),CSize(100,100),pContext))
 {
  TRACE0(_T("Failed to create first pane\n"));
  return false;
 }

 SetActiveView((CMapView*)m_wndSplitter.GetPane(0,0));

 return TRUE;
}

原文地址:https://www.cnblogs.com/8586/p/1361528.html