我想把一个窗口分成三份,代码如下,运行没有什么错误,创建返回成功,但是就是不能在界面上看到后面分的列,只能看到开始份的两行,请大侠指教!
if(!m_wndSplitter.CreateStatic(this, 2, 1))
{
return FALSE;
}
if(!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) ||
!m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CPlayBackView), CSize(100, 100), pContext))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
if(!m_wndSplitter2.CreateStatic(m_wndSplitter.GetPane(1, 0), 1, 2))
{
return FALSE;
}
if(!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) ||
!m_wndSplitter2.CreateView(0, 1, RUNTIME_CLASS(CPlayBackView), CSize(100, 100), pContext))
{
m_wndSplitter2.DestroyWindow();
return FALSE;
}

解决方案 »

  1.   

    m_HSplitterWnd.CreateStatic(this,1,2,SPLS_DYNAMIC_SPLIT|WS_CHILD|WS_VISIBLE,AFX_IDW_PANE_FIRST); if (!m_HSplitterWnd.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(130,200), pContext)){
    TRACE0("Failured to create the treeview.\n");
    return FALSE;
    }
    if(!m_VSplitterWnd.CreateStatic(&m_HSplitterWnd,2,1,WS_CHILD|WS_VISIBLE, 
    m_HSplitterWnd.IdFromRowCol(0, 1))){
    TRACE0("Create second splitterwnd failured.\n");
    return FALSE;
    }
    if(!m_VSplitterWnd.CreateView(0,0,RUNTIME_CLASS(CListTask),CSize(100,150),pContext)){
    TRACE0("Create listtask failured.\n");
    return FALSE;
    }
    if(!m_VSplitterWnd.CreateView(1,0,RUNTIME_CLASS(CNetAntsView),CSize(100,100),pContext)){
    TRACE0("Create mainview failured.\n");
    return FALSE;
    }
    m_VSplitterWnd.RecalcLayout();
    m_HSplitterWnd.RecalcLayout();
      

  2.   

    正确代码:
    if(!m_wndSplitter.CreateStatic(this, 2, 1))
    {
    return FALSE;
    }
    if(!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) )
    { m_wndSplitter.DestroyWindow();
    return FALSE;
    }
    if(!m_wndSplitter2.CreateStatic(&m_wndSplitter,1, 2,WS_CHILD|WS_VISIBLE,m_wndSplitter.IdFromRowCol(0,1))))
    return FALSE; if(!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) ||
    !m_wndSplitter2.CreateView(0, 1, RUNTIME_CLASS(CPlayBackView), CSize(100, 100), pContext))
    {
    m_wndSplitter2.DestroyWindow();
    return FALSE;
    }
      

  3.   

    运行下面的代码:
    BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {
    if(!m_wndSplitter.CreateStatic(this, 2, 1))
    {
    return FALSE;
    }
    //Modify the codes in here!
    if(!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) )
    {
    m_wndSplitter.DestroyWindow();
    return FALSE;
    }

    //Modify the codes in here!
    if(!m_wndSplitter2.CreateStatic(&m_wndSplitter, 1, 2,WS_CHILD | WS_VISIBLE,m_wndSplitter.IdFromRowCol(1,0))
    {
    return FALSE;
    }
    if(!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) ||
    !m_wndSplitter2.CreateView(0, 1, RUNTIME_CLASS(CPlayBackView), CSize(100, 100), pContext))
    {
    m_wndSplitter2.DestroyWindow();
    return FALSE;
    }
    return TRUE;//omit the warning!
    }
    -----------------------------------------------------
    说明:
    1、你既然打算在m_wndSplitter 的pane(1,0)进行二次拆分,这就是的pane(1,0)已经不存在,他被后来m_wndSplitter2拆分出的两个窗口覆盖,(个人理解!),这使得你不应该创建m_wndSplitter.pane(1,0),删掉:
    m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CPlayBackView), CSize(100, 100), pContext)。
    2、修改m_wndSplitter2.CreateStatic()的创建方法为:
    if(!m_wndSplitter2.CreateStatic(&m_wndSplitter, 1, 2,WS_CHILD | WS_VISIBLE,m_wndSplitter.IdFromRowCol(1,0))
    {
    return FALSE;
    }
    //也许可以不需要修改这一段代码!因为它应该与你的代码相同:
    //maybe same as your codes,but it give you more controling !
    //I think you should not use the codes:m_wndSplitter.GetPane(1, 0) to replace the //codes &m_wndSplitter in the function CSplitterWnd::CreateStatic(),Test it and  //tell me!
    if(!m_wndSplitter2.CreateStatic(m_wndSplitter.GetPane(1, 0), 1, 2))
    {
    return FALSE;
    }Run it &Enjoy it!
    ---------------------
    Nan jing YPC!
    [email protected]
      

  4.   

    布局太差重帖!
    运行下面的代码:
    BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {
    if(!m_wndSplitter.CreateStatic(this, 2, 1))
    {
    return FALSE;
    }
    //Modify the codes in here!
    if(!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) )
    {
    m_wndSplitter.DestroyWindow();
    return FALSE;
    }

    //Modify the codes in here!
    if(!m_wndSplitter2.CreateStatic(&m_wndSplitter, 1, 2,WS_CHILD | WS_VISIBLE,m_wndSplitter.IdFromRowCol(1,0))
    {
    return FALSE;
    }
    if(!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) ||
    !m_wndSplitter2.CreateView(0, 1, RUNTIME_CLASS(CPlayBackView), CSize(100, 100), pContext))
    {
    m_wndSplitter2.DestroyWindow();
    return FALSE;
    }
    return TRUE;//omit the warning!
    }
    -----------------------------------------------------
    说明:
    1、你既然打算在m_wndSplitter 的pane(1,0)进行二次拆分,这就是的pane(1,0)已经不存在,他被后来m_wndSplitter2拆分出的两个窗口覆盖,(个人理解!),这使得你不应该创建m_wndSplitter.pane(1,0),删掉:
    m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CPlayBackView), CSize(100, 100), pContext)。
    2、修改m_wndSplitter2.CreateStatic()的创建方法为:
    if(!m_wndSplitter2.CreateStatic(&m_wndSplitter, 1, 2,WS_CHILD | WS_VISIBLE,m_wndSplitter.IdFromRowCol(1,0))
    {
    return FALSE;
    }
    也许可以不需要修改这一段代码!因为它应该与你的代码相同:maybe same as your codes,but it give you more controling !I think you should not use the codes:m_wndSplitter.GetPane(1, 0) to replace the codes &m_wndSplitter in the function CSplitterWnd::CreateStatic(),Test it and  tell me!
    if(!m_wndSplitter2.CreateStatic(m_wndSplitter.GetPane(1, 0), 1, 2))
    {
    return FALSE;
    }
    ---------------------
    Run it &Enjoy it!
    ---------------------
    Nan jing YPC!
    [email protected]
      

  5.   

    布局太差重帖!
    运行下面的代码:
    BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {
    if(!m_wndSplitter.CreateStatic(this, 2, 1))
    {
    return FALSE;
    }
    //Modify the codes in here!
    if(!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) )
    {
    m_wndSplitter.DestroyWindow();
    return FALSE;
    }

    //Modify the codes in here!
    if(!m_wndSplitter2.CreateStatic(&m_wndSplitter, 1, 2,WS_CHILD | WS_VISIBLE,m_wndSplitter.IdFromRowCol(1,0))
    {
    return FALSE;
    }
    if(!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) ||
    !m_wndSplitter2.CreateView(0, 1, RUNTIME_CLASS(CPlayBackView), CSize(100, 100), pContext))
    {
    m_wndSplitter2.DestroyWindow();
    return FALSE;
    }
    return TRUE;//omit the warning!
    }
    -----------------------------------------------------
    说明:
    1、你既然打算在m_wndSplitter 的pane(1,0)进行二次拆分,这就是的pane(1,0)已经不存在,他被后来m_wndSplitter2拆分出的两个窗口覆盖,(个人理解!),这使得你不应该创建m_wndSplitter.pane(1,0),删掉:
    m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CPlayBackView), CSize(100, 100), pContext)。
    2、修改m_wndSplitter2.CreateStatic()的创建方法为:
    if(!m_wndSplitter2.CreateStatic(&m_wndSplitter, 1, 2,WS_CHILD | WS_VISIBLE,m_wndSplitter.IdFromRowCol(1,0))
    {
    return FALSE;
    }
    也许可以不需要修改这一段代码!因为它应该与你的代码相同:
    maybe same as your codes,but it give you more controling !I think you should not use the codes:m_wndSplitter.GetPane(1, 0) to replace the codes &m_wndSplitter in the function CSplitterWnd::CreateStatic(),Test it and  tell me!
    if(!m_wndSplitter2.CreateStatic(m_wndSplitter.GetPane(1, 0), 1, 2))
    {
    return FALSE;
    }
    ---------------------
    Run it &Enjoy it!
    ---------------------
    Nan jing YPC!
    [email protected]