ShadowButton.h
资源名称:VC++Excel.rar [点击查看]
上传用户:jinq198
上传日期:2014-05-21
资源大小:111k
文件大小:3k
源码类别:
文件操作
开发平台:
Visual C++
- ////////////////////////////////////////////////////////////////////
- // 类名: 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_)