MFC创建分割视图

先预览下效果

MFC创建分割视图_第1张图片

 

实现步骤:

1、在MainFrame中添加OnCreateClient事件,并添加下述成员CSplitterWnd m_wndSplitterAB,m_wndSplitter1

2、在事件中加入下述代码即可

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{

	m_wndSplitterAB.CreateStatic(this,1,2);
	m_wndSplitterAB.CreateView(0,1,RUNTIME_CLASS(CMapView),CSize(200,400),pContext);

	m_wndSplitter1.CreateStatic(&m_wndSplitterAB,2,1,WS_CHILD|WS_VISIBLE,m_wndSplitterAB.IdFromRowCol(0,0));
	m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CFileView),CSize(200,400),pContext);
	m_wndSplitter1.CreateView(1,0,RUNTIME_CLASS(CFileView),CSize(200,400),pContext);

	m_wndSplitterAB.SetColumnInfo(0,750,0); //设定左边的视图的宽度
	m_wndSplitter1.SetRowInfo(0,200,0); //设定上面的视图的宽度


	return TRUE;
}


 

你可能感兴趣的:(mfc,分割视图,SplitterWnd)