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

📄 skinbtn.h

📁 一个界面类似QQ界面的小程序
💻 H
字号:
/************************************************************************ 
* 文件名:    SkinBtn.h 
* 文件描述:  图片按钮 
* 创建人:    黄锐坤(Nuk), 2006年08月22日
* 版本号:    1.0 
************************************************************************/ 

#pragma once
#include <atlimage.h>       


// CSkinBtn

class CSkinBtn : public CButton
{
	DECLARE_DYNAMIC(CSkinBtn)

public:
	CSkinBtn();
	virtual ~CSkinBtn();

	typedef enum state
	{
		NORMAL,
		HOVER,
		DOWN,
		DISABLE
	}state;

protected:
	DECLARE_MESSAGE_MAP()

	CImage  m_imgNormal;
	CImage  m_imgHover;
	CImage  m_imgDown;
	CImage  m_imgDisable;

private:
	state m_state;
	COLORREF m_fg, m_bg;
	bool m_bMouseOver;
	bool m_bEnabled;
	CFont *m_pFont;
	
	bool m_bDCStored;//是否已经保存背景图
	
	CImage m_hMouseInIcon;
	CImage m_hMouseOutIcon;
	CPoint m_textPos;
	CRect m_iconRect;

	CDC m_memDC;

public:
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
protected:
	virtual void PreSubclassWindow();
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
protected:	
	//在按钮中填充颜色
	void DrawFilledRect(CDC *DC, CRect R, COLORREF color);
	//设置按钮上的字体颜色
	void DrawButtonText(CDC *DC, CRect R, CString str, COLORREF TextColor);
	void DrawButton();
public:
	void SetOwnerDraw(bool IsDraw);
	void SetImage(UINT nNormalID, UINT nHoverID, UINT nDownID, UINT nDisableID);
	void SetImage(CString strNormal, CString strHover, CString strDown, CString strDisable);
	void SetIcon(CString  strMouseOut,CString strMouseIn);
	void SetColor(COLORREF fgcolor,COLORREF bgcolor);
	void SetTextPos(CPoint point);
	CImage* GetPaintImage(){return &m_imgNormal;}
	CImage* GetPaintIcon(){return &m_hMouseOutIcon;}
	CPoint GetTextPos(){return m_textPos;}
	COLORREF GetFGColor() { return m_fg; }	
	COLORREF GetBGColor() { return m_bg; }
	CRect GetRectInParent();
	CRect GetIconRect(){return m_iconRect;}
public:
	afx_msg void OnEnable(BOOL bEnable);
};

⌨️ 快捷键说明

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