BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 在此添加专用代码和/或调用基类
// create a splitter with 1 row, 2 columns
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
// add the first splitter pane - the default view in column 0
if (!m_wndSplitter.CreateView(0, 0,
pContext->m_pNewViewClass, CSize(400, 0), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
// add the second splitter pane - which is a nested splitter with 2 rows
if (!m_wndSplitter2.CreateStatic(
&m_wndSplitter, // our parent window is the first splitter
3, 1, // the new splitter is 2 rows, 1 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndSplitter.IdFromRowCol(0, 1)
// new splitter is in the first row, 2nd column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
// now create the two views inside the nested splitter
//int cyText = max(lpcs->cy - 70, 20); // height of text pane
if (!m_wndSplitter2.CreateView(0, 0,
RUNTIME_CLASS(CSpeedView), CSize(0, 150), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
if (!m_wndSplitter2.CreateView(1, 0,
RUNTIME_CLASS(CGearView), CSize(0, 150), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
if (!m_wndSplitter2.CreateView(2, 0,
RUNTIME_CLASS(CHeartView), CSize(0, 0), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
// it all worked, we now have two splitter windows which contain
// three different views
return TRUE;