我把窗口静态拆分成两个,可是怎样才能限制分割线的移动,或者直接让它固定我本想继承CSplitterWnd类自己重写,可是用程序向导却找不到CSplitterWnd基类。各位有什么办法,请教教!谢谢
解决方案 »
- MFC的窗体图标的问题.启动窗体可以正常加载图标,其它窗体不能。为啥?
- 关于BCG无法设置工具栏位置
- 请问:如何获得机器的ipx地址,本机的和其他机器的.谢谢.
- 有关进程内部信息的讨论?PS有分
- 请问SAFEARRAY怎么操作?
- 想在CListBox的OnRbuttonDown()中发送消息WM_LBUTTONDOWN,怎么写SendMessage()?
- 弹出任务栏菜单?
- 我的IOCP模型架构(高手请指点)
- 为何无人帮助我?是否可以通过Windows API函数监测到当前系统是否连接到打印机?
- 请tiongkohlang(SDK)进来拿分!以谢谢你的源代码!
- 五个5算24在线等待
- 请问有关线程的问题!
Just override WM_NCHITTEST message, from your derived CSplitterWnd class, then I add a member variable called m_bLock, and the following functions:
// public void CSplitterWndEx::Lock( BOOL bLock )
{
m_bLock = bLock;
} // override the WM_NCHITTEST message UINT CSplitterWndEx::OnNcHitTest( CPoint point )
{
if( m_bLock )
return HTNOWHERE; // if locked
return CSplitterWnd::OnNcHitTest( point );
} Also remember to init m_bLock with a default from the contructor, after creating your splitter and views, call m_wndSplitterWnd.Lock( TRUE ); // to lock splitter Have fun... Regards Shaun
Submitted By: Shaun (2001/11/11)
--------------------------------------
Add new class derived from CSplitterWnd
and then mask the message WM_MOUSEMOVE,WM_SETCURSOR,WM_LBUTTON
directly uses the message of CWnd as the following :
then replace your CSplitterWnd with CFixedSplitter
enjoy it!
-------------
#if !defined(AFX_FIXEDSPLITTER_H__9DB2BF9B_1C2E_483F_985E_FC38AB087B05__INCLUDED_)
#define AFX_FIXEDSPLITTER_H__9DB2BF9B_1C2E_483F_985E_FC38AB087B05__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// FixedSplitter.h : header file
///////////////////////////////////////////////////////////////////////////////
// CFixedSplitter windowclass CFixedSplitter : public CSplitterWnd
{
// Construction
public:
CFixedSplitter();// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFixedSplitter)
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CFixedSplitter(); // Generated message map functions
protected:
//{{AFX_MSG(CFixedSplitter)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_FIXEDSPLITTER_H__9DB2BF9B_1C2E_483F_985E_FC38AB087B05__INCLUDED_)------------------
// FixedSplitter.cpp : implementation file
//#include "stdafx.h"
#include "Fun.h"
#include "FixedSplitter.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CFixedSplitterCFixedSplitter::CFixedSplitter()
{
}CFixedSplitter::~CFixedSplitter()
{
}
BEGIN_MESSAGE_MAP(CFixedSplitter, CSplitterWnd)
//{{AFX_MSG_MAP(CFixedSplitter)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_SETCURSOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFixedSplitter message handlersvoid CFixedSplitter::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CWnd::OnMouseMove(nFlags, point);
}void CFixedSplitter::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CWnd::OnLButtonDown(nFlags, point);
}BOOL CFixedSplitter::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
return CWnd::OnSetCursor(pWnd, nHitTest, message);
}---------------------
添加类时,选择基类为 Generic CWnd
然后再相应的h文件和cpp文件中,用CSplitterWnd代替CWnd