📄 advbtn.h
字号:
#if !defined(AFX_UNIBUTTON_H__EBEB2EA0_A067_11D2_9E44_0020182F735A__INCLUDED_)
#define AFX_UNIBUTTON_H__EBEB2EA0_A067_11D2_9E44_0020182F735A__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CAdvButton : public CButton
{
public:
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAdvButton)
public:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
//自绘制函数
protected:
virtual void PreSubclassWindow();
//子类化
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//Windows消息处理
//}}AFX_VIRTUAL
protected:
//{{AFX_MSG(CAdvButton)
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
//Windows消息处理—背景擦除
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
//Windows消息处理—鼠标移动
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//Windows消息处理—创建
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//鼠标左键按下
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//鼠标左键弹起
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
UINT m_nBorder;
LONG m_lfEscapement;
COLORREF m_nColor, m_sColor, m_hColor, m_dColor;
CBitmap * m_pNormal;
CBitmap * m_pSelected;
CBitmap * m_pHover;
CBitmap * m_pDisabled;
CPoint m_CenterPoint;
BOOL m_bMouseDown;
BOOL m_bHover;
BOOL m_bCapture;
HRGN m_hRgn;
BOOL m_bNeedBitmaps;
void DrawButton(CDC * pDC, CRect * pRect, UINT state);
void PrepareStateBitmaps(CDC * pDC, CRect * pRect);
BOOL HitTest(CPoint point);
void RgnPixelWork(CDC * pDC, CRgn * pRgn);
void FrameRgn3D(HDC hDC, const HRGN hRgn, BOOL bSunken);
void CheckHover(CPoint point);
protected:
void PrepareNormalState(CDC * pDC, CDC * pMemDC, CRect * pRect);
void PrepareSelectedState(CDC * pDC, CDC * pMemDC, CRect * pRect);
void PrepareHoverState(CDC * pDC, CDC * pMemDC, CRect * pRect);
void PrepareDisabledState(CDC * pDC, CDC * pMemDC, CRect * pRect);
void DrawButtonCaption(HDC hDC, CRect * pRect, BOOL bEnabled, BOOL bSunken);
void PaintRgn(CDC * pDC, CDC * pMemDC, CBitmap * pBitmap, COLORREF color, CRect * pRect, BOOL bEnabled, BOOL bSunken);
public:
CAdvButton(); // constructor
virtual ~CAdvButton(); // destructor
BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const CPoint point, const HRGN hRgn, CWnd* pParentWnd, UINT nID);
BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const CPoint point, const HRGN hRgn, CWnd* pParentWnd, UINT nID, COLORREF color);
BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const CPoint point, const HRGN hRgn, CWnd* pParentWnd, UINT nID, UINT nBorder, COLORREF nColor, COLORREF sColor, COLORREF hColor, COLORREF dColor);
BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const CPoint point, const HRGN hRgn, CWnd* pParentWnd, UINT nID, UINT nBorder, LONG lfEscapement, COLORREF nColor, COLORREF sColor, COLORREF hColor, COLORREF dColor);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_UNIBUTTON_H__EBEB2EA0_A067_11D2_9E44_0020182F735A__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -