先贴出代码吧,很简单
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
CRect rct;
GetClientRect(&rct);
CSize size = rct.Size();
size.cx /= 2;
size.cy /= 2; // 创建拆分窗口
if (!m_wndSplitter.CreateStatic(this, 1, 2))
return FALSE; // Create main drawing view
m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CTestView), size, pContext); // Create left splitter window
if (!m_wndLeftSplitter.CreateStatic(&m_wndSplitter, 2, 1,
WS_CHILD | WS_VISIBLE, m_wndSplitter.IdFromRowCol(0, 0)))
return FALSE; // Create Tv
m_wndLeftSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), size, pContext);
// Create Lv
m_wndLeftSplitter.CreateView(1, 0, RUNTIME_CLASS(CEqmLv), size, pContext); return TRUE;
}此为SDI工程
CEqmLv继承自CListView。
我想要的结果是:竖直切割器m_wndSplitter将Frame分为左右两部分,右边放CTestView(派生自CView),水平切割器m_wndLeftSplitter将左边分为上下两部分,上边放CLeftView(派生自CTreeView),下边放CEqmLv。上述代码确实能分隔成功,问题是:程序运行起来时,CLeftView和CEqmLv的宽度都很小,将近0,宽度并不是我想要的size.cx大小,只能手工拖动竖直分割条,才能看见CLeftView和CEqmLv,而右边的CTestView是全屏大小。
热心的兄弟给说说,是怎么回事,如何才能达到我想要的效果,谢谢,在线等

解决方案 »

  1.   

    你修改一下size,你几个分隔条都写的一样的。
      

  2.   

    这里有个例子:
    http://www.vckbase.com/document/viewdoc/?id=192 应该可以达到你的效果了!
      

  3.   

    建立View后m_wndSplitter.SetColumnInfo(0,左宽度,0);
    m_wndSplitter.SetColumnInfo(1,右宽度,0);
    m_wndLeftSplitter.SetRowInfo(0,上高度,0);
    m_wndLeftSplitter.SetRowInfo(0,下高度,0);
      

  4.   

    给你一个现成的.
    我刚在项目里面的写的,左面一个,有面三个的
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if(m_wndSplitter1.CreateStatic(this,1,2)==NULL) 
    return FALSE;

    CRect rect;
    this->GetClientRect(rect);
    //  if (!m_wndSplitter1.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) ||
    //  !m_wndSplitter1.CreateView(0, 1, RUNTIME_CLASS(CRightFrame), CSize(100, 100), pContext))
    //  {
    //  m_wndSplitter.DestroyWindow();
    //  return FALSE;
    //  }
    m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CLeftView),CSize((int)(rect.Width() * 0.18),0),pContext); if(m_wndSplitter2.CreateStatic(&m_wndSplitter1,3,1,WS_CHILD|WS_VISIBLE,
    m_wndSplitter1.IdFromRowCol(0, 1))==NULL) 
    return FALSE; m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CRightUpView),CSize(20,35),pContext); 
    m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(CListCtrlView),CSize(300,(int)(rect.Height() * 0.3)),pContext); 
    m_wndSplitter2.CreateView(2,0,RUNTIME_CLASS(CRightBtView),CSize(300,100),pContext); 

    leftview = (CLeftView*)m_wndSplitter1.GetPane (0, 0) ;
        rightframe = (CRightFrame*)m_wndSplitter1.GetPane (0, 1) ;
    }
      

  5.   

    刚才那个有没有用的注释调的,从新发一次
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if(m_wndSplitter1.CreateStatic(this,1,2)==NULL) 
    return FALSE;

    CRect rect;
    this->GetClientRect(rect);
    m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CLeftView),CSize((int)(rect.Width() * 0.18),0),pContext); if(m_wndSplitter2.CreateStatic(&m_wndSplitter1,3,1,WS_CHILD|WS_VISIBLE,
    m_wndSplitter1.IdFromRowCol(0, 1))==NULL) 
    return FALSE; m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CRightUpView),CSize(20,35),pContext); 
    m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(CListCtrlView),CSize(300,(int)(rect.Height() * 0.3)),pContext); 
    m_wndSplitter2.CreateView(2,0,RUNTIME_CLASS(CRightBtView),CSize(300,100),pContext); 

    leftview = (CLeftView*)m_wndSplitter1.GetPane (0, 0) ;
        rightframe = (CRightFrame*)m_wndSplitter1.GetPane (0, 1) ;
    }
      

  6.   

    可以重载onsize()函数实现你想要的窗口大小