文件1 class CMainFrame : public CFrameWnd 添加如下代码
public:
CSplitterWnd m_splMainCols;
CSplitterWnd m_splRightRows;
BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
cpp文件添加函数
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if(!m_splMainCols.CreateStatic(this, 1, 3))
{
return FALSE;
}
if(!m_splMainCols.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 0), pContext))
{
return FALSE;
}
/*
if(!m_splMainCols.CreateView(0, 1, RUNTIME_CLASS(CLeftView), CSize(500, 0),pContext))
{
return FALSE;
}
*/
if(!m_splMainCols.CreateView(0, 2, RUNTIME_CLASS(CLeftView), CSize(0, 0),pContext))
{
return FALSE;
}
if(!m_splRightRows.CreateStatic(&m_splMainCols, 2, 1, WS_CHILD|WS_VISIBLE, m_splMainCols.IdFromRowCol(0,1) ))
{
return FALSE;
}
if(!m_splRightRows.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(0, 300), pContext))
{
return FALSE;
}
if(!m_splRightRows.CreateView(1, 0, RUNTIME_CLASS(CLeftView), CSize(0, 0), pContext))
{
return FALSE;
}
//m_splMainCols.SetRowInfo(0, 350, 0); //重新设置行宽
//m_splMainCols.RecalcLayout();
//m_splMainCols.SetColumnInfo(2,100,50);
return TRUE;
}