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

📄 shadowbutton.h

📁 delphi 开发的自动升级源码
💻 H
字号:
////////////////////////////////////////////////////////////////////
// 类名: CShadowButton
//
// 说明: 类似于原DOS下的阴影效果按钮
//
// 用法:
//       1、把文件shadowbutton.h、shadowbutton.cpp加入工程中
//       2、在使用的对话框中加入头文件,#include shadowbutton.h
//       3、声明要改变的按钮成员变量(可在类向导中进行),如:
//           CShadowButton	m_Cancel;
//       4、在OnInitDialog()中加入下面语句,进行初始化
//           m_Cancel.SetDefaultFace();
//           m_Cancel.SetDefaultButton();
//
// 修改: 徐景周, 加入PreSubclassWindow(),实现按钮构造时自绘属性.
/////////////////////////////////////////////////////////////////////
#if !defined(AFX_SHADOWBUTTON_H__F2E1D200_7147_11D5_98C1_8B96D28F4E0A__INCLUDED_)
#define AFX_SHADOWBUTTON_H__F2E1D200_7147_11D5_98C1_8B96D28F4E0A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


// shadowbutton.h : header file

/////////////////////////////////////////////////////////////////////////////
// CShadowButton window


class CShadowButton : public CButton
{
// Construction
public:
	CShadowButton();

// Attributes
public:

// Operations
public:
	
	void SetShadowSize(CSize cs)
	{
		m_sizeShadow.cx = cs.cx;
		m_sizeShadow.cy = cs.cy;
		Redraw();
	}


protected:

	BOOL m_bDefault;

	COLORREF m_crBorderColor;
	COLORREF m_crColor;
	COLORREF m_crShadowColor;
	COLORREF m_crTextColor;
	COLORREF m_crTransColor;

	CSize m_sizeShadow;
	int m_nBorderSize;

	int m_nShadowXOffset;
	int m_nShadowYOffset;

	CBitmap m_bmpNormal;
	CBitmap m_bmpDisabled;


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CShadowButton)
	public:
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);	
	protected:
	virtual void PreSubclassWindow();
	//}}AFX_VIRTUAL

// Implementation
public:
	void SetDefaultFace();
	BOOL SetDefaultButton( BOOL bState = TRUE );
	
	void SetShadowOffset(int x, int y);
	BOOL LoadBitmaps(COLORREF crTransColor, UINT nresNormalBmp, UINT nresDisabledBmp = 0);
	void SetColors(COLORREF crColor, COLORREF crBorder, COLORREF crShadow, COLORREF crText);
	void SetBorderSize(int nSize);
	void Redraw();
	virtual ~CShadowButton();

	// Generated message map functions
protected:
	void DrawClient(CDC *pdc, CRect *pRect, int x, int y);
	void DrawDown(CDC *pDC, CRect *pRect);
	void DrawUp(CDC *pDC, CRect *pRect);
	//{{AFX_MSG(CShadowButton)
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

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

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

#endif // !defined(AFX_SHADOWBUTTON_H__F2E1D200_7147_11D5_98C1_8B96D28F4E0A__INCLUDED_)

⌨️ 快捷键说明

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