singlesquare.cs

来自「game tetris :), this file is a little to」· CS 代码 · 共 68 行

CS
68
字号
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 + =
减小字号Ctrl + -
显示快捷键?