CStatic派生的类CStaticDemo能够响应我onpaint函数中的代码,却响应不了OnMouseMove & CtlColor?
其中CStaticDemo.h中
protected:
//{{AFX_MSG(CStaticDemo)
afx_msg void OnPaint();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
//}}AFX_MSG
其中CStaticDemo.cpp中
BEGIN_MESSAGE_MAP(CStaticDemo, CStatic)
//{{AFX_MSG_MAP(CUnderLine)
ON_WM_PAINT()
ON_WM_MOUSEMOVE()
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////
void CStaticDemo::OnMouseMove(UINT nFlags, CPoint point)
{
AfxMessageBox("mousemove ok!");
CStatic::OnMouseMove(nFlags, point);
}
///////////////////////////////
void CStaticDemo::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect rect;
GetClientRect(rect);
CString strText;
GetWindowText(strText);
dc.SetBkMode(TRANSPARENT);
dc.TextOut(rect.left+2 ,rect.top,strText);
}
我在dailog中添加一个static控件,
DDX_Control(pDX,IDC_STATIC,m_test1);
结果,能够响应我onpaint函数中的代码,当我鼠标移上IDC_STATIC时,跟不到CStaticDemo::OnMouseMove(UINT nFlags, CPoint point) 中!为什么?