VC++代码找错!急!(嵌套分割窗口)

来源:百度知道 编辑:UC知道 时间:2024/09/23 08:29:25
(1)先建一行两列;(2)再将第二列分为三行。第一步成功,但第二步通过编译,但仍显示一行两列。代码如下:
CRect rect;
this->GetClientRect(rect);
m_splitterwnd1.CreateStatic(this,1,2);
m_splitterwnd1.CreateView(0,0,RUNTIME_CLASS(CJDToolsForCPUCardView),CSize(rect.Width()/5,rect.Height()),pContext);
m_splitterwnd1.CreateView(0,1,RUNTIME_CLASS(CCommandListSplitter),CSize(4*rect.Width()/5,rect.Height()),pContext);
m_splitterwnd2.CreateStatic(m_splitterwnd1.GetPane(0,1),3,1);
m_splitterwnd1.GetPane(0,1)->GetClientRect(rect);
m_splitterwnd2.CreateView(0,0,RUNTIME_CLASS(CRightSplitter),CSize(rect.Width(),rect.Height()/5),pContext);
m_splitterwnd2.CreateView(1,0,RUNTIME_CLASS(CRightSplitter),CSize(rect.Width(),rect.Height()/5),pContext);
m_splitterwnd2.CreateView(2,0,RUNTIME_CLASS(CRightSplitter),CSize(rect.Width(),3*rect.Height()/5),pContext);
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext * pContext)
{
CRect rect;
this->GetClientRect(re

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// 先把整个 View 分成两行一列的形式
if (!m_wndSplitter1.CreateStatic(this, 2, 1))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}

// 把第一行分成两列
if (!m_wndSplitter2.CreateStatic(&m_wndSplitter1, 1, 2))
{
TRACE0("Failed to Create StaticSplitter m_wndSplitter2\n");
return FALSE;
}
// 设置第一行第一列
if (!m_wndSplitter2.CreateView(0, 0,
pContext->m_pNewViewClass, CSize(130, 50), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}

// 设置第一行第二列
if (!m_wndSplitter2.CreateView(0, 1,
RUNTIME_CLASS(CView_Wnd1), CSize(40, 300), pContext))
{
TRACE