spherebutton.h
来自「Visual C++图形用户界面开发指南 李博轩等编著 配套源码光盘」· C头文件 代码 · 共 82 行
H
82 行
#if !defined(AFX_SPHEREBUTTON_H__E38C830E_B929_11D2_A3C4_F74379B0725C__INCLUDED_)
#define AFX_SPHEREBUTTON_H__E38C830E_B929_11D2_A3C4_F74379B0725C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define Rad2Deg 180.0/3.1415
#define LIGHT_SOURCE_ANGLE -2.356 // -2.356 radians = -135 degrees, i.e. From top left
#include <math.h>
class CSphereButton : public CButton
{
// Construction
public:
CSphereButton( bool bDepressed=false, bool bCenterAlign=true );
// Attributes
public:
bool MouseOverItem();
// Operations
public:
protected:
COLORREF GetColor( double dAngle, COLORREF crBright, COLORREF crDark);
void DrawCircle( CDC* pDC, CPoint p, LONG lRadius, COLORREF crColour, BOOL bDashed = FALSE);
void DrawCircle( CDC* pDC, CPoint p, LONG lRadius, COLORREF crBright, COLORREF crDark);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSphereButton)
public:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
public:
int m_nMargin;
int m_nRadius;
public:
bool Depress( bool Down );
bool IsDepressed();
void Set_Check( int nCheck );
virtual ~CSphereButton();
// Generated message map functions
protected:
//{{AFX_MSG(CSphereButton)
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
//}}AFX_MSG
void OnMouseEnter(void);
void OnMouseLeave(void);
DECLARE_MESSAGE_MAP()
private:
CRgn m_btnRgn;
CPoint m_ptCenter;
CRect m_textRect;
CFont m_BoldFont;
bool m_bMouseOver;
bool m_bDepressed;
bool m_bMouseTracking;
bool m_bLMouseButtonDown;
bool m_bDrawFocusRect;
bool m_bCenterAlign;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BOUNCEBUTTON_H__E38C830E_B929_11D2_A3C4_F74379B0725C__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?