如题

解决方案 »

  1.   

    Cbutton : CWnd ,button同样可以响应OnMouseMove
      

  2.   

    不懂啊 
    可以用SWITCH来判断移动了哪个按钮的么在 OnMouseMove函数里
      

  3.   

    void CGameClientDlg::OnMouseMove(UINT nFlags, CPoint point)
    {
    // TODO: 在此添加消息处理程序代码和/或调用默认值 if(point.x>777 && point.x<799 && point.y>1 && point.y<22)//此区域是关闭键
    {
    m_mb_close.state = BUTTON_STATE_STOP;
    } CDialog::OnMouseMove(nFlags, point);
    }
      

  4.   

    我记得好像直接可以用SWITCH(?) case(控件ID)来 判断鼠标是否移动到控件上的 
    SWITCH (?) 现在就是找不到问号是什么啊
      

  5.   

    当前按钮.getwindowrect(rect);
    ScreenToClient(rect);
    根据rect判断就可以了
      

  6.   

    我记得好像直接可以用SWITCH(?) case(控件ID)来 判断鼠标是否移动到控件上的 
    SWITCH (?) 现在就是找不到问号是什么啊/////////////////////////////////////////////////////////////////////////////你那个应该是判断控件焦点的吧?
      

  7.   

    在CButton内部判断不是挺好的啊?
      

  8.   

    BOOL CWnd::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if(pMsg->hwnd== m_button.m_hWnd &&pMsg->message==WM_MOUSEMOVE)
    {
                int pos=0;
    }
    return CWnd::PreTranslateMessage(pMsg);
    }
      

  9.   

    // Get the current mouse position
    CPoint pointMouse;
    GetCursorPos(&pointMouse);
    // Transform into client coordinates
    ScreenToClient(&pointMouse);
    CRect rect;
    yourButtom.GetClientRect(&rect);
    if (rect.PtInRect(point))
    {
        // mouse is over button
    }