Square.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace 俄罗斯方块
{
    class Square
    {
        public Point location;
        public Size size;
        public Color forecolor;
        public Color backcolor;

        public Square(Size size,Color forecolor,Color backcolor)
        {
            this.size = size;
            this.forecolor = forecolor;
            this.backcolor = backcolor;
        }

        public void Draw(Graphics g)
        {
            GraphicsPath gp = new GraphicsPath();
            Rectangle rec = new Rectangle(location, size);
            gp.AddRectangle(rec);
            Color[] surrounColor = new Color[] { backcolor };
            PathGradientBrush pb = new PathGradientBrush(gp);
            pb.CenterColor = forecolor;
            pb.SurroundColors = surrounColor;

            g.FillPath(pb, gp);

        }

        public void Erase(Graphics g)
        {
            Rectangle rec = new Rectangle(location,size);
            g.FillRectangle(new SolidBrush(GameField.backColor),rec);
        }

    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。