在继承的自定义控件类中加入以下函数即可 BOOL CPuzzleArea::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if (pMsg->message == WM_MOUSEMOVE) { CPoint point(pMsg->pt.x, pMsg->pt.y); ScreenToClient(&point); // Add your code here ClientToScreen(&point); }
ModifyStyle(0,SS_NOTIFY);
BOOL CPuzzleArea::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if (pMsg->message == WM_MOUSEMOVE)
{
CPoint point(pMsg->pt.x, pMsg->pt.y);
ScreenToClient(&point);
// Add your code here
ClientToScreen(&point);
}
return CStatic::PreTranslateMessage(pMsg);
}