📄 singlesquare.cs
字号:
using System;
using System.Drawing;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
namespace GATetrisControl
{
[Serializable]
public class SingleSquare
{
#region Constructor
public SingleSquare(TetrisGrid tg)
{
parent = tg;
filled = false;
rect = Rectangle.Empty;
}
public bool Filled
{
get { return filled; }
set { filled = value; }
}
public Color MyColor
{
get { return color; }
set { color = value; }
}
#endregion
#region Methods
internal void Draw(Graphics g)
{
Rectangle r = rect;
r.Width -= 2;
r.Height -= 2;
SolidBrush brush = new SolidBrush(color);
g.FillRectangle(brush,r.Left+1,r.Top+1,r.Width-1,r.Height-1);
g.DrawLine(new Pen(parent.settings.lightBorder),r.Left,r.Bottom,r.Left,r.Top);
g.DrawLine(new Pen(parent.settings.lightBorder),r.Left,r.Top,r.Right,r.Top);
g.DrawLine(new Pen(parent.settings.darkBorder),r.Right,r.Top,r.Right,r.Bottom);
g.DrawLine(new Pen(parent.settings.darkBorder),r.Right,r.Bottom,r.Left,r.Bottom);
brush.Dispose();
}
#endregion
#region Fields
internal Rectangle rect;
internal bool filled;
internal Color color;
internal TetrisGrid parent;
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -