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

📄 singlesquare.cs

📁 game tetris :), this file is a little too big but it s run well, besides, it also has file descripti
💻 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 + -