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

📄 colorstatic.cpp

📁 通过vc语言从任意一个文件夹的读出文件名和路径操作的程序
💻 CPP
字号:
// ColorStatic.cpp : implementation file
//

#include "stdafx.h"
#include "ExtractFileList.h"
#include "ColorStatic.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CColorStatic

CColorStatic::CColorStatic()
{
}

CColorStatic::~CColorStatic()
{
}

BEGIN_MESSAGE_MAP(CColorStatic, CStatic)
	//{{AFX_MSG_MAP(CColorStatic)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CColorStatic message handlers

void CColorStatic::SetTextColor(COLORREF crTextColor)
{
    m_crTextColor = crTextColor;
}

void CColorStatic::OnPaint() 
{
	CPaintDC dc(this);
	dc.SetTextColor(m_crTextColor);
	dc.SetBkMode(TRANSPARENT);
	dc.SelectObject(this->GetFont());

	CRect rect;
	CBrush BGBrush;
	int nTextLeft = 0, nTextTop = 0;

	this->GetClientRect(&rect);

	TEXTMETRIC tm;
	dc.GetTextMetrics(&tm);
	CString strText;
	this->GetWindowText(strText);
	nTextTop = rect.top + ((rect.Height()-tm.tmHeight) >> 1);

	if (strText.GetLength() > 0)
	{	
		dc.TextOut(nTextLeft, nTextTop, strText);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -