123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- /************************************************************************
- * 程序名: 精仿QQ主界面
- * 制作人: 李克平, 2011年04月11日
- * 版本号: 1.0
- ************************************************************************/
- #pragma once
- #include <atlimage.h>
- #include "EnBitmap.h"
- // CSkinButton
- class CSkinButton : public CButton
- {
- DECLARE_DYNAMIC(CSkinButton)
- public:
- CSkinButton();
- virtual ~CSkinButton();
- typedef enum state
- {
- NORMAL,
- HOVER,
- DOWN,
- DISABLE
- }state;
- protected:
- DECLARE_MESSAGE_MAP()
- //CImage m_imgNormal;
- //CImage m_imgHover;
- //CImage m_imgDown;
- //CImage m_imgDisable;
- CEnBitmap m_bmpButton;
- CEnBitmap m_bmpNormal;
- CEnBitmap m_bmpHover;
- CEnBitmap m_bmpDown;
- CEnBitmap m_bmpDisable;
- CEnBitmap m_bmpIconButton;
- private:
- state m_state;
- COLORREF m_fg, m_bg;
- COLORREF m_crBack;
- bool m_bMouseOver;
- BOOL m_bDown;
- bool m_bEnabled;
- CFont *m_pFont;
-
- bool m_bDCStored;//是否已经保存背景图
-
- CImage m_hMouseInIcon;
- CImage m_hMouseOutIcon;
- CPoint m_textPos;
- CRect m_iconRect;
- CDC m_memDC;
- public:
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
- afx_msg void OnTimer(UINT_PTR nIDEvent);
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
- protected:
- virtual void PreSubclassWindow();
- virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
- protected:
- //在按钮中填充颜色
- void DrawFilledRect(CDC *DC, CRect R, COLORREF color);
- //设置按钮上的字体颜色
- void DrawButtonText(CDC *DC, CRect R, CString str, COLORREF TextColor);
- void DrawButton();
- public:
- void SetOwnerDraw(bool IsDraw);
- void SetImage(UINT nNormalID, UINT nHoverID, UINT nDownID, UINT nDisableID);
- void SetImage(CString strNormal, CString strHover, CString strDown, CString strDisable);
- void loadHoverBGBmp(LPCTSTR szImagePath);
- void LoadImage(LPCTSTR szImagePath,COLORREF crBack = RGB(255,0,255),BOOL bResetSize =TRUE);
- BOOL LoadBitmap(UINT uIDRes,COLORREF crBack,BOOL bResetSize = TRUE);
- void SetIcon(CString strMouseOut,CString strMouseIn);
- void SetColor(COLORREF fgcolor,COLORREF bgcolor);
- void SetTextPos(CPoint point);
- CEnBitmap* GetPaintBmp(){return &m_bmpNormal;}
- CImage* GetPaintIcon(){return &m_hMouseOutIcon;}
- CPoint GetTextPos(){return m_textPos;}
- COLORREF GetFGColor() { return m_fg; }
- COLORREF GetBGColor() { return m_bg; }
- CRect GetRectInParent();
- void SetStatusBmp();
- CRect GetIconRect(){return m_iconRect;}
- int Width(){return m_bmpNormal.Width();}
- int Heighth(){return m_bmpNormal.Height();}
- void ResetButtonSize(BOOL bResetSize);
- public:
- afx_msg void OnEnable(BOOL bEnable);
- };
|