我重载了一个CStatic类,我想让鼠标经过这个类创建的对象时弹出一个消息,可是我的怎么没有弹出呢?
// MyStatic.cpp : implementation file
//#include "stdafx.h"
#include "NetWatcherViewer.h"
#include "MyStatic.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CMyStaticCMyStatic::CMyStatic()
{
}CMyStatic::~CMyStatic()
{
}
BEGIN_MESSAGE_MAP(CMyStatic, CStatic)
//{{AFX_MSG_MAP(CMyStatic)
ON_WM_PAINT()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CMyStatic message handlersvoid CMyStatic::OnPaint() 
{
CPaintDC dc(this); // device context for painting

// TODO: Add your message handler code here
CString ctrText;
CDC MemDC;
CBitmap MemBitmap;
MemDC.CreateCompatibleDC(&dc);
//建立一个与屏幕显示兼容的位图
    CRect   rect; 
    GetWindowRect(&rect); 
//MemBitmap.CreateCompatibleBitmap(&dc,300,300);
MemBitmap.CreateCompatibleBitmap(&dc,rect.Width (),rect.Height ());
//将位图选入到内存显示设备中
CBitmap *pOldBit=MemDC.SelectObject(&MemBitmap);
CPen newPen(PS_ENDCAP_ROUND , 1, RGB(255,255,255));
CPen newPen1(PS_DOT  , 1, RGB(0,78,115));
CPen* pOldPen = MemDC.SelectObject(&newPen);
//绘图
MemDC.FillSolidRect(0,0,rect.Width(),rect.Height(),RGB(150,150,150)); MemDC.MoveTo(40,0);//纵坐标
MemDC.LineTo(40, rect.Height());
MemDC.SelectObject(newPen1);
ctrText.Format("通道1");
MemDC.TextOut(0,rect.Height ()/2-8, ctrText);


MemDC.SelectObject(newPen);
MemDC.MoveTo(40,rect.Height ()/2);
MemDC.LineTo (rect.Width(),rect.Height()/2); dc.BitBlt(0  ,0 ,rect.Width() ,rect.Height() ,&MemDC,0,0,SRCCOPY);
MemDC.SelectObject(pOldPen);
MemBitmap.DeleteObject();
MemDC.DeleteDC();
} void CMyStatic::OnMouseMove(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
MessageBox("hello");
CStatic::OnMouseMove(nFlags, point);
}