📄 bmpbutton.h
字号:
#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_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -