?以下代码拖动Edit控件,为何不成功?该怎么处理
????以下代码拖动Edit控件,为何不成功????
从CEdit继承的类CRtfEdit
构造函数如下:
CRtfEdit::CRtfEdit(CRect rct,CWnd* pParent)
{
HWND hwndEdit= CreateWindow (TEXT ("RichEdit"), NULL,
WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOVSCROLL |ES_WANTRETURN,
rct.left , rct.top , rct.Width() , rct.Height(), pParent->GetSafeHwnd(), (HMENU)0x5522,
NULL, NULL) ;
this->Attach(hwndEdit);
ASSERT(this->m_hWnd);
}
成员函数 :鼠标移动时弹出消息框
void CRtfEdit::OnMouseMove(UINT nFlags, CPoint point)
{
AfxMessageBox("OnMouseMove");
}
在对话框中实例化CRtfEdit类:
prtf=new CRtfEdit(CRect(0,0,200,200),this);
??????
程序运行后,显示Edit控件,
当鼠标在Edit控件上移动时,问题出来了——并没有看到AfxMessageBox("OnMouseMove")消息框!!!
弄不明白,还请各路高手不吝赐教,感激!!!
???????
------解决方案--------------------
CRtfEdit的消息处理过程函数在哪?处理了WM_MOUSEMOVE消息了吗?
------解决方案--------------------
WM_NCHITEST
------解决方案--------------------
BEGIN_MESSAGE_MAP(CRtfEdit, CRichEditCtrl)
//{{AFX_MSG_MAP(CRtfEdit)
ON_WM_TIMER()
//}}AFX_MSG_MAP
ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()
从CEdit继承的类CRtfEdit
构造函数如下:
CRtfEdit::CRtfEdit(CRect rct,CWnd* pParent)
{
HWND hwndEdit= CreateWindow (TEXT ("RichEdit"), NULL,
WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOVSCROLL |ES_WANTRETURN,
rct.left , rct.top , rct.Width() , rct.Height(), pParent->GetSafeHwnd(), (HMENU)0x5522,
NULL, NULL) ;
this->Attach(hwndEdit);
ASSERT(this->m_hWnd);
}
成员函数 :鼠标移动时弹出消息框
void CRtfEdit::OnMouseMove(UINT nFlags, CPoint point)
{
AfxMessageBox("OnMouseMove");
}
在对话框中实例化CRtfEdit类:
prtf=new CRtfEdit(CRect(0,0,200,200),this);
??????
程序运行后,显示Edit控件,
当鼠标在Edit控件上移动时,问题出来了——并没有看到AfxMessageBox("OnMouseMove")消息框!!!
弄不明白,还请各路高手不吝赐教,感激!!!
???????
------解决方案--------------------
CRtfEdit的消息处理过程函数在哪?处理了WM_MOUSEMOVE消息了吗?
------解决方案--------------------
WM_NCHITEST
------解决方案--------------------
BEGIN_MESSAGE_MAP(CRtfEdit, CRichEditCtrl)
//{{AFX_MSG_MAP(CRtfEdit)
ON_WM_TIMER()
//}}AFX_MSG_MAP
ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()