我将视图分成三块:左边为CTreeView,右上为CTextView,右下为CTreeView。现在想问怎么才能将CTextView和CTreeView之间的分割条不能被拖动??左右之间的分割条还是保留为拖动状态,先谢谢了          |CTextView
 CTreeView_________
          |CTreeViewBOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
//从中间将窗口左右先一分为二
if(!m_wndSplitter.CreateStatic( this, 1, 2))
{
return false;
}
//左边视图CTreeView
if(!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CTreeView), CSize(250,250), 
      pContext))
{
return false;
}
//再将右边视图再上下一分为二
if(!m_wndSplitter2.CreateStatic(&m_wndSplitter,2,1, WS_CHILD|WS_VISIBLE,m_wndSplitter.IdFromRowCol(0,1)))
{
return false;
}
//右上的CTextView视图
if(!m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CTextView), CSize(250,30), 
      pContext))
{
return false;
}
//右下的CListtView视图
if(!m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(CListtView), CSize(250,250), 
      pContext))
{
return false;
}

return 1;
}

解决方案 »

  1.   

    // LockableSplitter.h : header file
    //#ifndef __EK_LOCKABLE_SPLITTER_H__
    #define __EK_LOCKABLE_SPLITTER_H__/////////////////////////////////////////////////////////////////////////////
    // CEkLockableSplitter windowclass CEkLockableSplitter : public CSplitterWnd
    {
    // Construction
    public:
    CEkLockableSplitter();// Attributes
    public:// Operations
    public:
    void SetLock( BOOL bLock );
    BOOL GetLock() const;
    void ToggleLock();// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CEkLockableSplitter)
    //}}AFX_VIRTUAL// Implementation
    public:
    virtual ~CEkLockableSplitter();protected:
    BOOL m_bLocked; // Generated message map functions
    protected:
    //{{AFX_MSG(CEkLockableSplitter)
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
    afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };/////////////////////////////////////////////////////////////////////////////#endif  // __EK_LOCKABLE_SPLITTER_H__
      

  2.   

    // LockableSplitter.cpp : implementation file
    //#include "stdafx.h"
    #include "EkLockableSplitter.h"#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // CEkLockableSplitterCEkLockableSplitter::CEkLockableSplitter()
    {
    m_bLocked = FALSE;
    }CEkLockableSplitter::~CEkLockableSplitter()
    {
    }
    BEGIN_MESSAGE_MAP(CEkLockableSplitter, CSplitterWnd)
    //{{AFX_MSG_MAP(CEkLockableSplitter)
    ON_WM_LBUTTONDOWN()
    ON_WM_MOUSEMOVE()
    ON_WM_SETCURSOR()
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
    // CEkLockableSplitter operationsvoid CEkLockableSplitter::SetLock( BOOL bLock )
    {
    m_bLocked = bLock;
    }BOOL CEkLockableSplitter::GetLock() const
    {
    return m_bLocked;
    }void CEkLockableSplitter::ToggleLock()
    {
    m_bLocked = !m_bLocked;
    }/////////////////////////////////////////////////////////////////////////////
    // CEkLockableSplitter message handlersvoid CEkLockableSplitter::OnLButtonDown(UINT nFlags, CPoint point) 
    {
    if( m_bLocked )
    {
    // Bypass standard CSplitterWnd processing
    CWnd::OnLButtonDown(nFlags, point);
    }
    else
    {
    CSplitterWnd::OnLButtonDown(nFlags, point);
    }
    }void CEkLockableSplitter::OnMouseMove(UINT nFlags, CPoint point) 
    {
    if( m_bLocked )
    {
    // Bypass standard CSplitterWnd processing
    CWnd::OnMouseMove(nFlags, point);
    }
    else
    {
    CSplitterWnd::OnMouseMove(nFlags, point);
    }
    }BOOL CEkLockableSplitter::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
    {
    if( m_bLocked )
    {
    // Bypass standard CSplitterWnd processing
    return CWnd::OnSetCursor(pWnd, nHitTest, message);
    }
    else
    {
    return CSplitterWnd::OnSetCursor(pWnd, nHitTest, message);
    }
    }
      

  3.   

    to:DentistryDoctor(雅克医生<改行做程序员了>):能说的更详细点吗?我是新手,不是很懂,谢谢你了