一个SDI View切分成2个小窗口(两行一列) 上面窗口又拆分成1行两列(类似VC工作区)这三个小窗口的关系为List窗口|工作区窗口
-------------------
    输出窗口程序代码如下BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
// TODO: Add your specialized code here and/or call the base class
    CRect rect;
    GetClientRect(&rect);
       
    if (!m_wndSplitter1.CreateStatic(this, 2, 1) ||
        !m_wndSplitter1.CreateView(1,0, RUNTIME_CLASS
        (COutPutView), CSize(rect.Width(),rect.Height()/5), pContext) ||
        !m_wndSplitter2.CreateStatic(&m_wndSplitter1,1,2,WS_CHILD|WS_VISIBLE,
            m_wndSplitter1.IdFromRowCol(0,0)) ||
        !m_wndSplitter2.CreateView(0,1,RUNTIME_CLASS
            (CWorkSpaceView), CSize(rect.Width()/2,rect.Height()-rect.Height()/5), pContext) ||
        !m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS
            (CListFileView), CSize(rect.Width()/2,rect.Height()-rect.Height()/5), pContext))
        
    {
        return FALSE;
    }    return TRUE;
最后的运行结果是 底下的Output窗口占了整个界面大小,请问怎么回事,谢谢

解决方案 »

  1.   

    在OnSize中,判断若切分成功,则SetColumnInfo 和SetRowInfo设置大小后,然后调用RecalcLayout就行
      

  2.   

    在哪里实现呢?
    我试了
    void CMainFrame::OnSize(UINT nType, int cx, int cy) 
    {
    CFrameWnd::OnSize(nType, cx, cy);

    // TODO: Add your message handler code here
        CRect rect;
        GetClientRect(&rect);
        
        m_wndSplitter1.SetRowInfo(1, rect.Width()/2, 10);
        m_wndSplitter1.RecalcLayout();
    }和
    void COutPutView::OnSize(UINT nType, int cx, int cy) 
    {
    CEditView::OnSize(nType, cx, cy);

    // TODO: Add your message handler code here
    //    CRect rect;
    //    GetClientRect(&rect);
    //
    //    CMainFrame* pMainfrm;
    //    pMainfrm = (CMainFrame*)AfxGetMainWnd();
    //    pMainfrm->m_wndSplitter1.SetRowInfo(1, rect.Width()/2, 0);
    //    pMainfrm->m_wndSplitter1.RecalcLayout();}这两个地方都报错呵呵,谢谢
      

  3.   

    设置一个BOOL标记bFlag,初始化为FALSE,在CMainFrame类的OnCreateClient中,最后return TRUE;之前设置为TRUE;
    在CMainFrame的WM_SIZE的消息响应函数中OnSize中这里写
    void CMainFrame::OnSize(UINT nType, int cx, int cy)  
    {
    CFrameWnd::OnSize(nType, cx, cy);// TODO: Add your message handler code here
      if(bFlag)
    {
      CRect rect;
      GetClientRect(&rect);
        
      m_wndSplitter1.SetRowInfo(1, rect.Width()/2, 10);
      m_wndSplitter1.RecalcLayout();
    }
    }