colorstatic.cpp
来自「程序开发中写log用的实现代码, C语言代码, 可以不用修改再C++或MFC中使」· C++ 代码 · 共 59 行
CPP
59 行
// 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 + =
减小字号Ctrl + -
显示快捷键?