如题:小弟想把SDI窗体分割成一个顶部是一通行,下面是两列的窗体,怎样办呀

解决方案 »

  1.   

    不是一句话就能教会你的。
    找本MFC的书,好好看看
      

  2.   

    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {m_wndFormSplitter.CreateStatic(this,2,1,WS_VISIBLE|WS_CHILD,AFX_IDW_PANE_FIRST+1);

    m_wndFormSplitter.CreateView(0,0,RUNTIME_CLASS(CMyForm),CSize(200,200),pContext);

    m_wndViewSplitter.CreateStatic(&m_wndFormSplitter,1,2,WS_VISIBLE|WS_CHILD,m_wndFormSplitter.IdFromRowCol(1,0));

    m_wndViewSplitter.CreateView(0,0,RUNTIME_CLASS(CListInfoView),
    CSize(100,100),pContext); m_wndViewSplitter.CreateView(0,1,RUNTIME_CLASS(CListInfoView),
    CSize(100,100),pContext);
      

  3.   


    上面的CMyForm,CListInfoView这样的类怎样定义?它们的基类是什么?是CFormView吗?
      

  4.   

    我分别插入三个dialog窗体,并关联了三个类,然后写进去后运行时就有中断错误,让立刻中止,重试,忽略这要的错误,为什么?
      

  5.   

    CListInfoView从你需要的视类派生啊,需要CFormView就用CFormView嘛
      

  6.   

    继承CFormView的对话框的属性的样式要改成"下层"
      

  7.   

    http://book.51cto.com/art/200810/92647.htm
      

  8.   

    自己改一下:
    CSplitterWnd split;
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {
    // TODO: Add your specialized code here and/or call the base class    CRect rect;
        GetClientRect(&rect);
        split.CreateStatic(this,2,1);    
        split.CreateView(0,0,RUNTIME_CLASS(CShuxingdaohengView),CSize(rect.Width(),rect.Height()-rect.Height()/200),pContext);
        split.CreateView(1,0,RUNTIME_CLASS(TreeView),CSize(rect.Width(),rect.Height()/200),pContext);
        return true;
    }int TreeView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
    {
    if (CTreeView::OnCreate(lpCreateStruct) == -1)
    return -1;

    // TODO: Add your specialized creation code here
    CRect rect;
    GetClientRect(&rect);
    CCreateContext *pContext=(CCreateContext*)lpCreateStruct->lpCreateParams; split1.CreateStatic(this ,1,2);
    split1.CreateView(0,0,RUNTIME_CLASS(CLeftFormView),CSize(rect.Width()/4,rect.Height()),pContext);
    split1.CreateView(0,1,RUNTIME_CLASS(CListview),CSize(1,1),pContext);
    return 0;
    }
      

  9.   

    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs,CCreateContext * pContext)
    {
       wndSplitter.CreateStatic(this,1,2)
       wndSplitter.CreateView(0,0,RUNTIME_CLASS(CTop),CSize(200,200),pContext);
       return TRUE;
    }其中CTop类是一个基类为CFormView且关联一个对话框的类,可是还是出现Debug Assertion Faild!
      

  10.   

    对话框的"属性"----"样式"----"样式[S]"-----"下层"
                              Styles      Child 
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs,CCreateContext * pContext) 

      wndSplitter.CreateStatic(this,1,2) 
      wndSplitter.CreateView(0,0,RUNTIME_CLASS(CTop),CSize(200,200),pContext); 
    ///必须要有wndSplitter.CreateView(0,1,.......); 不能少
       wndSplitter.CreateView(0,1,RUNTIME_CLASS(视图类名),CSize(200,200),pContext); 
      return TRUE; 

      

  11.   

    搞定,结帖,多谢 dengxuxing美女,有空见个面撒