void CSwitchStatic::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
//这儿实现鼠标移过时的效果
CRect rect;
this->GetClientRect(&rect);
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP1);
CBrush brush(&bitmap);
CClientDC dc(this);
dc.FillRect(rect,&brush);
//
AfxMessageBox("11111111");
//
CDialog::OnMouseMove(nFlags, point);
}
在对话框上:
头文件:
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
源文件:
ON_WM_MOUSEMOVE()
void CJHConfDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
LPRECT lpRect=new RECT;
GetDlgItem(IDC_STATIC_TOOLBTN0)->GetWindowRect(lpRect);
ScreenToClient(lpRect);
if(point.x<lpRect->right && point.x>lpRect->left && point.y<lpRect->bottom && point.y>lpRect->top)
{
POINTS points;
::PostMessage(GetDlgItem(IDC_STATIC_TOOLBTN0)->m_hWnd,WM_MOUSEMOVE,NULL,(LPARAM)&points);
}
CDialog::OnMouseMove(nFlags, point);
}