基本window风格的mfc单文档程序中:你所需要做步骤是:
创建一个基于CSplittterWnd的类CMySplitterWnd,然后在类里面实现OnLButtonDown和OnSetcursor消息
这里要注意的是:你必须手动添加消息:
第一步:.h文件中加入
//{{AFX_MSG(CmySplitterWnd)
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() //这一句不能少
第二步:
BEGIN_MESSAGE_MAP(CmySplitterWnd,CSplitterWnd)
//{{AFX_MSG_MAP(CmySplitterWnd)
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_SETCURSOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
第三步:
void CmySplitterWnd::OnLButtonDown(UINT nFlags,CPoint point)
{
}
void CmySplitterWnd::OnMouseMove(UINT nFlags,CPoint point)
{
CWnd::OnMouseMove(nFlags,point);
}
BOOL CmySplitterWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
//return CWnd::OnSetCursor(pWnd,nHitTest,message);
return TRUE;
}
第四步,你要做的是:
在CMainFrame 中你要将对象m_wndSplitter的类变为CMySplitterWnd