鼠标在控件上位置该怎么判断
鼠标在控件上位置该怎么判断
那你把静态文本框都设为Notify,派生一个CStatic类,响应WM_MOUSEMOVE事件,里面的那个point就是你想要的值
BOOL CtestDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_MOUSEMOVE&& pMsg->hwnd != m_hWnd)
{
CPoint pt;
pt = pMsg->pt;
FromHandle(pMsg->hwnd)->ScreenToClient(&pt); //这个pt就是了
}
BOOL CtestDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_MOUSEMOVE&& pMsg->hwnd != m_hWnd)
{
CRect rt;
GetDlgItem(IDC_EDIT1)->GetClientRect(&rt); //可以不要
GetDlgItem(IDC_EDIT1)->ScreenToClient(&pMsg->pt);
}
return CDialogEx::PreTranslateMessage(pMsg);
}