mybtn.h

来自「VCsuishu fudai de yixie chengxuyuanma」· C头文件 代码 · 共 81 行

H
81
字号
#if !defined(AFX_MYBTN_H__09B2C50A_6162_4F2F_B9E2_04D006284C30__INCLUDED_)
#define AFX_MYBTN_H__09B2C50A_6162_4F2F_B9E2_04D006284C30__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MyBtn.h : header file
//

#define WM_MYBTNLBDOWN   WM_USER + 5//自定义消息
/////////////////////////////////////////////////////////////////////////////
// CMyBtn window

class CMyBtn : public CWnd
{
// Construction
public:
	CMyBtn();

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMyBtn)
	public:
	virtual BOOL Create(CWnd* pParentWnd, UINT ctlID, UINT nID = NULL);
	protected:
	//}}AFX_VIRTUAL

// Implementation
public:
	void SetTextDownClr(COLORREF textDownClr);
	void SetTextUpClr(COLORREF textUpClr);
	void SetShapeClr(COLORREF shapeClr);
	void SetFrontClr(COLORREF frontClr);
	void SetIsSelected(BOOL bSelected);
	void SetShape(int nShape);
	void SetState(int nState);
	void DrawFace(CDC* pDC,CRect rect);
	virtual ~CMyBtn();

	// Generated message map functions
protected:
	COLORREF m_frClr;
	COLORREF m_shapeClr;
	COLORREF m_textUpClr;
	COLORREF m_textDownClr;

	CRgn m_rgn;
	CRect m_clientRect;
	UINT m_ctlID;//保存ID

	CBitmap* m_pOldBmp;
	CBitmap m_memBmp;
	CDC m_memDC;

	BOOL m_bLButtonDown;

	UINT m_nStateNum;//状态
	UINT m_nShape;//形状
	
	//{{AFX_MSG(CMyBtn)
	afx_msg void OnPaint();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MYBTN_H__09B2C50A_6162_4F2F_B9E2_04D006284C30__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?