📄 ccolorbutton.h
字号:
#if !defined(AFX_CCOLORBUTTON_H__E8187082_4089_11D4_B28E_00609771BC08__INCLUDED_)
#define AFX_CCOLORBUTTON_H__E8187082_4089_11D4_B28E_00609771BC08__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// CcolorButton.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// ColorcButton window
class ColorcButton : public CButton
{
DECLARE_DYNAMIC(ColorcButton)
// Construction
public:
ColorcButton();
// Attributes
public:
// I added
BOOL Attach(const UINT nID, CWnd* pParent,
const COLORREF BGColor = RGB(192, 123, 192), // 按纽的背景色
const COLORREF FGColor = RGB(1, 1, 1) // 文本颜色
);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ColorcButton)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~ColorcButton();
// Generated message map functions
/*protected:
//{{AFX_MSG(ColorcButton)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
*/
protected:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS); //重定义虚拟函数DrawItem
void DrawFrame(CDC *DC, CRect R,BOOL stat); //绘制按纽框
void DrawFilledRect(CDC *DC, CRect R, COLORREF color); //填充按纽框
void DrawLine(CDC *DC, CRect EndPoints, COLORREF color);
void DrawLine(CDC *DC, long left, long top, long right, long bottom, COLORREF color);
void DrawButtonText(CDC *DC, CRect R, const char *Buf, COLORREF TextColor);
//绘制按纽上的文本
COLORREF GetFGColor() { return m_fg; }
COLORREF GetBGColor() { return m_bg; }
private:
COLORREF m_fg, m_bg;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CCOLORBUTTON_H__E8187082_4089_11D4_B28E_00609771BC08__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -