⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skinbutton.h

📁 包括了一些VC编程实例
💻 H
字号:
#if !defined(AFX_SKINBUTTON_H__F3A4A4C8_725E_4184_8A4D_A7A848F839FE__INCLUDED_)
#define AFX_SKINBUTTON_H__F3A4A4C8_725E_4184_8A4D_A7A848F839FE__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CSkinButton window
#include "BitmapEx.h"

class CSkinButtonResource
{

	CBitmapEx	m_bmpButton;
	int			m_TopHeight, m_LeftWidth, m_RightWidth, m_BottomHeight;
	BOOL		m_bTile;
	BOOL		m_bTrans;
	BOOL		m_bInited;

public:
	CSkinButtonResource()
	{
		m_bInited = FALSE;
	}
	
	BOOL DrawAImage( CDC *pDC, CRect r, CRect sr );
	BOOL LoadSkin( const char * skinfile );
	BOOL DrawImage(CDC *pDC, CRect r, int state);

	friend class CSkinButton;
};


class CSkinButton : public CButton
{
	DECLARE_DYNAMIC(CSkinButton)	
// Construction
	CSkinButtonResource * m_res;

	BOOL	m_bMouseIn;
	BOOL	m_bDown;
	BOOL	m_bFocus;
	BOOL	m_bEnable;

	COLORREF m_backcolor;
	COLORREF m_textcolor;
public:
	CSkinButton();


// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSkinButton)
	//}}AFX_VIRTUAL

// Implementation
public:
	BOOL EnableWindow( BOOL bEnable = TRUE );
	BOOL GetRegion();
	BOOL DrawImage( CBitmapEx& bmp );
	BOOL DrawText( CDC * pDC );
	BOOL SetResource( CSkinButtonResource * res )
	{
		m_res = res;
		//GetRegion();
		return res != NULL;
	}
	virtual ~CSkinButton();

	// Generated message map functions
protected:
	//{{AFX_MSG(CSkinButton)
	afx_msg void OnPaint();
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnEnable(BOOL bEnable);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

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

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

#endif // !defined(AFX_SKINBUTTON_H__F3A4A4C8_725E_4184_8A4D_A7A848F839FE__INCLUDED_)

⌨️ 快捷键说明

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