1、将主视图类从CView 改为CScrollView
.h .cpp文件中所有的CView都要改
2、主视图类的.h文件前加doc类的前置声明: class TestDoc;
否则报错,缺少";"之类的
3、MainFrame.h 添加 CSplitterWnd m_wndSplitter;
.cpp重写OnCreateClient,然后添加相关语句即可
- BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
- {
- // TODO: Add your specialized code here and/or call the base class
- BOOL ret = m_wndSplitter.CreateStatic(this,2,1);
- /*
- 将视图分为上下两屏,上屏:CDraw_MIGView,下屏:CVelocityView
- */
- ret |= m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CDraw_MIGView),
- CSize(700,250),pContext);
- ret |= m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CVelocityView),
- CSize(700,450),pContext);
- return ret;
- //return CFrameWnd::OnCreateClient(lpcs, pContext);
- }
转载于:https://blog.51cto.com/qianray/1186042