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

📄 colorstatic.cpp

📁 FTP探索工具源代码,内涵测试以及详细说明。
💻 CPP
字号:

#include "stdafx.h"
#include "..\resource.h"
#include "ColorStatic.h"

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

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

void CColorStatic::OnPaint() 
{
	CPaintDC dc(this); 

	dc.FillSolidRect(m_rc,RGB(123,156,235)); //绘制背景

	dc.SelectObject(&m_font);	 		
	dc.SetBkMode(TRANSPARENT); //设置背景透明
	dc.SetTextColor(RGB(255,255,255)); //设置文字颜色为白色
	dc.DrawText(m_strText.GetBuffer(0),m_strText.GetLength(),&m_rc,DT_SINGLELINE | DT_VCENTER | DT_LEFT | DT_PATH_ELLIPSIS);
}



void CColorStatic::SetText(LPCTSTR lpszText)
{
	m_strText = lpszText;
	Invalidate();  
}


/********************************************************************/
/*																	*/
/* Function name : PreSubclassWindow								*/
/* Description   : Initialize control variables						*/
/*																	*/
/********************************************************************/
void CColorStatic::PreSubclassWindow() 
{
	GetClientRect(m_rc);

	m_font.CreateFont(12, 0,0,0,FW_BOLD, 0,0,0,
		DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
		DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "宋体");
	
	CStatic::PreSubclassWindow();		
}

⌨️ 快捷键说明

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