BMPButton.h
上传用户:xiaoke98
上传日期:2014-06-29
资源大小:5718k
文件大小:2k
- #if !defined(AFX_BMPBUTTON_H__CA9A4CB0_6CA0_48D2_8BC0_1493C5CCDE8F__INCLUDED_)
- #define AFX_BMPBUTTON_H__CA9A4CB0_6CA0_48D2_8BC0_1493C5CCDE8F__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- // BMPButton.h : header file
- //
- #include "winuser.h"
- //用于跟踪鼠标的状态
- extern "C" WINUSERAPI BOOL WINAPI TrackMouseEvent(LPTRACKMOUSEEVENT lpEventTrack);
- /////////////////////////////////////////////////////////////////////////////
- // CBMPButton window
- #define BS_TYPEMASK SS_TYPEMASK
- class CBMPButton : public CButton
- {
- // Construction
- public:
- CBMPButton();
- // Attributes
- public:
- BOOL setBmpFile(CString& strFileName);
- BOOL setBmpData(char* pData, int iDataLen);
- BOOL OpenBmpFile(void);
- void Display(void);
- void setColor(COLORREF color);
- void setOffset(int iLeftTop, int iRightBottom);
- CString getImagePath(void);
- void getData(char* pBuffer, int& iDataLen);
- void ClearBmp(void);
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CBMPButton)
- //}}AFX_VIRTUAL
- virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
- protected:
- virtual void PreSubclassWindow();
-
- // Implementation
- public:
- virtual ~CBMPButton();
- // Generated message map functions
- protected:
- //{{AFX_MSG(CBMPButton)
- // NOTE - the ClassWizard will add and remove member functions here.
- //}}AFX_MSG
- afx_msg BOOL OnEraseBkgnd( CDC* pDC );
- afx_msg void OnPaint();
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
- afx_msg void OnMouseOut();
- DECLARE_MESSAGE_MAP()
- private:
- CString m_strImagePath;
- char* m_pBuffer;
- int m_iBufferLen;
- int m_iWidth;
- int m_iHeight;
- HBITMAP m_hBitmap;
- UINT m_nTypeStyle; // Button style
- COLORREF m_color;
- int m_iLeftTopOffset;
- int m_iRightBottomOffset;
- HBITMAP BufferToHBITMAP();
- BOOL MouseOver();
- BOOL m_bOver;
- BOOL m_bFirst;
- };
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_BMPBUTTON_H__CA9A4CB0_6CA0_48D2_8BC0_1493C5CCDE8F__INCLUDED_)