📄 colorstatic.cpp
字号:
// ColorStatic.cpp: implementation of the CColorStatic class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ColorStatic.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC(CColorStatic, CStatic)
// Map the messages
BEGIN_MESSAGE_MAP(CColorStatic, CStatic)
ON_WM_CTLCOLOR_REFLECT()
END_MESSAGE_MAP()
// CColorStatic constructor/destructor
CColorStatic::CColorStatic()
{
m_clrBack = ::GetSysColor(COLOR_3DFACE);
m_brBkgnd.CreateSolidBrush(m_clrBack);
}
// CColorStatic attributes
void CColorStatic::SetTextColor(COLORREF clrText)
{
m_clrText = clrText;
this->Invalidate();
}
// CColorStatic overloaded functions
void CColorStatic::PreSubclassWindow()
{
DWORD dwStyle = this->GetStyle();
::SetWindowLong(this->GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);
CStatic::PreSubclassWindow();
}
// CColorStatic message handlers
HBRUSH CColorStatic::CtlColor(CDC *pDC, UINT nCtlColor)
{
nCtlColor = nCtlColor; /* avoid warning */
pDC->SetTextColor(m_clrText);
pDC->SetBkColor(m_clrBack);
return (HBRUSH)m_brBkgnd;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -