square.cpp
来自「俄罗斯方块 采用MFC和GDI+编写的,自己感觉写得不是很好,不过看上去还行」· C++ 代码 · 共 62 行
CPP
62 行
#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 + =
减小字号Ctrl + -
显示快捷键?