colorstatic.cpp

来自「演示在角色扮演游戏中如何利用人工神经网络进行智能分类的训练」· C++ 代码 · 共 57 行

CPP
57
字号
// ColorStatic.cpp : implementation file
//

#include "stdafx.h"
#include "ANNApp.h"
#include "ColorStatic.h"

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

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

CColorStatic::CColorStatic()
{
	_bkColor   = GetSysColor( COLOR_BTNFACE );	
	_textColor = GetSysColor( COLOR_BTNTEXT );	
}

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::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	if (IsWindowEnabled() == false)
		dc.SetTextColor(GetSysColor( COLOR_GRAYTEXT ));
	else
		dc.SetTextColor( _textColor );

	dc.SetBkColor( _bkColor );

	CString text;
	GetWindowText( text );

	CRect rect; 
	GetClientRect( &rect); 
	dc.DrawText( text, &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE );

	// Do not call CStatic::OnPaint() for painting messages
}

⌨️ 快捷键说明

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