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

📄 displaygdiobjects.cpp

📁 The application wizard has created this SoccerDoctor application for you. This application not onl
💻 CPP
字号:
#include "StdAfx.h"
#include "DisplayGDIObjects.h"
#include "defines.h"

CDisplayGDIObjects::CDisplayGDIObjects(void)
{
	CreateGDIObjects();
}

CDisplayGDIObjects::~CDisplayGDIObjects(void)
{
	DeleteGDIObjects();
}

void CDisplayGDIObjects::CreateGDIObjects()
{
	// brushes
	_brushBlack.CreateSolidBrush(COLOR_BLACK);
	_brushRed.CreateSolidBrush(COLOR_RED);
	_brushWhite.CreateSolidBrush(COLOR_WHITE);
	_brushPink.CreateSolidBrush(COLOR_PINK);
	_brushYellow.CreateSolidBrush(COLOR_YELLOW);
	_brushBlue.CreateSolidBrush(COLOR_BLUE);
	_brushPurple.CreateSolidBrush(COLOR_PURPLE);

	// pens
	_penBlack.CreatePen(PS_SOLID, 1, COLOR_BLACK);
	_penRed.CreatePen(PS_SOLID, 1, COLOR_RED);
	_penWhite.CreatePen(PS_SOLID, 1, COLOR_WHITE);
	_penPink.CreatePen(PS_SOLID, 1, COLOR_PINK);

	// fonts
	_headingFont.CreateStockObject(SYSTEM_FONT);
	_scoreFont.CreateStockObject(SYSTEM_FONT);
	_timeFont.CreateStockObject(SYSTEM_FONT);
	_playerFont.CreateStockObject(SYSTEM_FONT);
}
void CDisplayGDIObjects::DeleteGDIObjects()
{
	// brushes
	_brushBlack.DeleteObject();
	_brushRed.DeleteObject();
	_brushWhite.DeleteObject();
	_brushPink.DeleteObject();
	_brushYellow.DeleteObject();
	_brushBlue.DeleteObject();
	_brushPurple.DeleteObject();
	
	// pens
	_penBlack.DeleteObject();
	_penRed.DeleteObject();
	_penWhite.DeleteObject();
	_penPink.DeleteObject();

	// fonts
	_headingFont.DeleteObject();
	_scoreFont.DeleteObject();
	_timeFont.DeleteObject();
	_playerFont.DeleteObject();
}
void CDisplayGDIObjects::ChangeFontSize(int nUnitSize)
{
	int nPointSize = 10 * nUnitSize;
	_headingFont.DeleteObject();
	if (!_headingFont.CreatePointFont(nPointSize, _T("Times New Roman"))){
		_headingFont.CreateStockObject(SYSTEM_FONT);
	}
	
	nPointSize *= 2;
	_scoreFont.DeleteObject();
	if (!_scoreFont.CreatePointFont(nPointSize, _T("System"))){
		_scoreFont.CreateStockObject(SYSTEM_FONT);
	}
		
	nPointSize = 8 * nUnitSize;
	_timeFont.DeleteObject();
	if (!_timeFont.CreatePointFont(nPointSize, _T("Times New Roman"))){
		_timeFont.CreateStockObject(SYSTEM_FONT);
	}
	
	nPointSize = 5 * nUnitSize;
	_playerFont.DeleteObject();
	if (!_playerFont.CreatePointFont(nPointSize, _T("Times New Roman"))){
		_playerFont.CreateStockObject(SYSTEM_FONT);
	}
}

⌨️ 快捷键说明

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