各位大虾:
单文档视图如何实现窗口的任意分割???
附上代码!

解决方案 »

  1.   

    重写OnCreateClient虚函数
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
    CCreateContext* pContext)
    {
    BOOL b1 = m_WndSplitter1.CreateStatic(this, 1,2);
    if( !b1 )
    {
    TRACE("创建分隔条窗口失败\n");
    AfxMessageBox("create splitwnd failed\n");
    return FALSE;
    }
    BOOL b2 = m_WndSplitter1.CreateView(
    0, 0, RUNTIME_CLASS(CLeftView), CSize(200,0), pContext) ;
    if( !b2 )
    {
    m_WndSplitter1.DestroyWindow();
    AfxMessageBox("create splitwnd failed\n");
    return  FALSE;
    }
    BOOL b3 = m_WndSplitter2.CreateStatic(
    &m_WndSplitter1, 2, 1, 
    WS_CHILD | WS_VISIBLE,
    m_WndSplitter1.IdFromRowCol(0,1));
    if( !b3 )
    {
    m_WndSplitter1.DestroyWindow();
    AfxMessageBox("create splitwnd failed\n");
    return FALSE;
    } BOOL b4 = m_WndSplitter2.CreateView(
    0, 0, RUNTIME_CLASS(CRightUpView), CSize(0, 320),pContext);
    if( !b4 )
    {
    m_WndSplitter1.DestroyWindow();
    m_WndSplitter2.DestroyWindow();
    AfxMessageBox("create splitwnd failed\n");
    return FALSE;
    }
    BOOL b5 = m_WndSplitter2.CreateView(
    1, 0, RUNTIME_CLASS(CRightDownView), CSize(0, 180),pContext);
    if( !b5 )
    {
    m_WndSplitter1.DestroyWindow();
    m_WndSplitter2.DestroyWindow();
    AfxMessageBox("create splitwnd failed\n");
    return FALSE;
    } return TRUE;
    }
    分割成三个窗口,左,右上,右下。
    三个视图.
    类成员变量,两个分割条。
    CSplitterWnd m_WndSplitter1;
    CSplitterWnd m_WndSplitter2;
      

  2.   

    要自己设置吧!你看看codeproject上面是否有现成的!