⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 colorstatic.cpp

📁 程序开发中写log用的实现代码, C语言代码, 可以不用修改再C++或MFC中使用, 可以将写log的函数使用方法同printf, 可以接收可变参数. 对于开发程序很有帮助.
💻 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 + -