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

📄 square.cpp

📁 俄罗斯方块 采用MFC和GDI+编写的,自己感觉写得不是很好,不过看上去还行
💻 CPP
字号:
#include "stdafx.h"
#include "Square.h"

Square::Square(void)
{
	this->check = false;
}

Square::Square(Size InitialSize, Color InitialBackcolor, Color InitForecolor)
{
	this->_Size = InitialSize;
	this->_ForeColor = InitForecolor;
	this->_BackColor = InitialBackcolor;
	this->check = true;
}

Square::~Square(void)
{
}

void Square::Show(HDC &hdc,DOCINFO & info)
{
	Graphics GameGraphics(hdc);
	StartDoc(hdc,&info);
	INT * count;
	int sum = 1;
	count = ∑
	GraphicsPath path;
	path.AddRectangle(RectF(this->_Location.X,this->_Location.Y,
		this->_Size.Width,this->_Size.Height));
	PathGradientBrush brush(&path);
	brush.SetCenterColor(this->_ForeColor);
	Color surroundColor[] = {this->_BackColor};
	brush.SetSurroundColors(surroundColor,count);

	StartPage(hdc);
	GameGraphics.FillPath(&brush,&path);

	EndPage(hdc);
	EndDoc(hdc);
}

void Square::Hide(HDC &hdc, DOCINFO &info,Color const& BackColor)
{
	StartDoc(hdc,&info);
	StartPage(hdc);

	Graphics GameGraphics(hdc);
	RectF rectSquare(this->_Location.X,this->_Location.Y,this->_Size.Width,this->_Size.Height);
	GameGraphics.FillRectangle(&SolidBrush(BackColor),rectSquare);

	EndPage(hdc);
	EndDoc(hdc);
}
bool Square::IsNull() const
{
	return this->check;
}
void Square::MakeNull()
{
	this->check = false;
}

⌨️ 快捷键说明

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