在界面设计时,有一位图或按扭,当鼠标放上去后 该按扭(或图象)变亮,当鼠标移开时,变暗,试问高手,如何实现? 请高手指点,先谢了。

解决方案 »

  1.   

    现在如一幅图,用作鼠标未移入时的状态,再在按钮的mousemove()中载入另一幅!
      

  2.   

    设置变量BOOL m_bInButtonRect;//判断是否鼠标处于按钮上
    得到按钮的矩形坐标m_bnButton.GetWindowRect(&m_rtButton); //CRect m_rtButton
    响应WM_MOUSEMOVE
    {
        POINT pt;
        GetCurPoint(&pt);
        if(m_rtButton.PtInRect(pt))
        {
           按钮变亮;
          .....
        }
        else
        { 
             。
        } 
      

  3.   

    在此你可以看到合适的例子:
    http://www.vckbase.com/code/listcode.asp?mclsid=3&sclsid=301
      

  4.   

    谢谢各位的发言。to andy_lau(天行键,君子当自强不息!) :在你的代码中,出现如下错误:
    {
        POINT pt;
        GetCurPoint(&pt); //error ;
        if(m_rtButton.PtInRect(pt))
        {
           按钮变亮;
          .....
        }
        else
        { 
             。
        }   error 错误如下:
    C2065: 'GetCurPoint' : undeclared identifier;怎么解决?