先定义的一个矩形,当鼠标进入这个矩形范围时,能显示弹起效果,
当鼠标按下时,能显示按下效果,当鼠标弹起时,能恢复正常效果.

解决方案 »

  1.   

    利用MouseMove()消息,判断当鼠标位于矩形内时,显示弹起效果,否则显示正常效果。
    利用MouseDown()消息,判断当鼠标单击且位于矩形内时,显示按下效果。
    利用MouseUp()消息,判断当鼠标放开且位于矩形内时,响应相应的函数。
      

  2.   

    继承CButton类
    class CMyButton : public CButton
    void CMyButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
    {
    // TODO: Add your code to draw the specified item
    //重新绘制按钮
    }void CMyButton::PreSubclassWindow() 
    {
    // TODO: Add your specialized code here and/or call the base class
    //判断按钮为自绘按钮 CButton::PreSubclassWindow();
    }
      

  3.   

    用CDC绘制很简单,
    void Draw3dRect( LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight );
    void Draw3dRect( int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight );
    3D效果是由下面两个颜色起作用:COLORREF clrTopLeft, COLORREF clrBottomRight 
      

  4.   

    大侠们谢了!
    还有得到设备环境CDC (为对话框客户区) 
    用Attach();HDC参数怎么填!