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

📄 mainform.cs

📁 这个源码是我从别的网站下载下来的!我是初学者,希望给我一点源码下载(文件包含连连看,俄罗斯方块,当代罗宾汉,智慧珠,贪吃蛇)
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace 自娱自乐
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class MainForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label labelTile;
		private System.Windows.Forms.Button GameExit;
		private System.Windows.Forms.Button AboutMe;
		private System.Windows.Forms.Label labelExplain;
		private System.Windows.Forms.Button ZHZ;
		private System.Windows.Forms.Button LBH;
		private System.Windows.Forms.Button ELS;
		private System.Windows.Forms.Button LLK;
		private System.Windows.Forms.Button TCS;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public MainForm()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
			this.labelTile = new System.Windows.Forms.Label();
			this.GameExit = new System.Windows.Forms.Button();
			this.AboutMe = new System.Windows.Forms.Button();
			this.labelExplain = new System.Windows.Forms.Label();
			this.ZHZ = new System.Windows.Forms.Button();
			this.LBH = new System.Windows.Forms.Button();
			this.ELS = new System.Windows.Forms.Button();
			this.LLK = new System.Windows.Forms.Button();
			this.TCS = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// labelTile
			// 
			this.labelTile.BackColor = System.Drawing.Color.Transparent;
			this.labelTile.Font = new System.Drawing.Font("新宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.labelTile.ForeColor = System.Drawing.Color.MediumBlue;
			this.labelTile.Name = "labelTile";
			this.labelTile.Size = new System.Drawing.Size(500, 30);
			this.labelTile.TabIndex = 0;
			this.labelTile.Text = "办 公 室 游 戏";
			this.labelTile.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// GameExit
			// 
			this.GameExit.BackColor = System.Drawing.Color.Transparent;
			this.GameExit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.GameExit.ForeColor = System.Drawing.Color.Red;
			this.GameExit.Location = new System.Drawing.Point(380, 340);
			this.GameExit.Name = "GameExit";
			this.GameExit.Size = new System.Drawing.Size(100, 20);
			this.GameExit.TabIndex = 7;
			this.GameExit.Text = "退 出 Esc";
			this.GameExit.Click += new System.EventHandler(this.GameExit_Click);
			// 
			// AboutMe
			// 
			this.AboutMe.BackColor = System.Drawing.Color.Transparent;
			this.AboutMe.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.AboutMe.ForeColor = System.Drawing.Color.Red;
			this.AboutMe.Location = new System.Drawing.Point(380, 310);
			this.AboutMe.Name = "AboutMe";
			this.AboutMe.Size = new System.Drawing.Size(100, 20);
			this.AboutMe.TabIndex = 8;
			this.AboutMe.Text = "关 于 作 者";
			this.AboutMe.Click += new System.EventHandler(this.AboutMe_Click);
			// 
			// labelExplain
			// 
			this.labelExplain.BackColor = System.Drawing.Color.Transparent;
			this.labelExplain.Font = new System.Drawing.Font("新宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.labelExplain.ForeColor = System.Drawing.Color.LawnGreen;
			this.labelExplain.Location = new System.Drawing.Point(10, 330);
			this.labelExplain.Name = "labelExplain";
			this.labelExplain.Size = new System.Drawing.Size(350, 20);
			this.labelExplain.TabIndex = 9;
			this.labelExplain.Text = "此程序仅供本人学习,请误用于其它用途!";
			// 
			// ZHZ
			// 
			this.ZHZ.BackColor = System.Drawing.Color.Transparent;
			this.ZHZ.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.ZHZ.ForeColor = System.Drawing.Color.Tomato;
			this.ZHZ.Location = new System.Drawing.Point(8, 130);
			this.ZHZ.Name = "ZHZ";
			this.ZHZ.Size = new System.Drawing.Size(100, 25);
			this.ZHZ.TabIndex = 13;
			this.ZHZ.Text = "智  慧  珠";
			this.ZHZ.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.ZHZ.Click += new System.EventHandler(this.ZHZ_Click);
			// 
			// LBH
			// 
			this.LBH.BackColor = System.Drawing.Color.Transparent;
			this.LBH.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.LBH.ForeColor = System.Drawing.Color.Tomato;
			this.LBH.Location = new System.Drawing.Point(8, 100);
			this.LBH.Name = "LBH";
			this.LBH.Size = new System.Drawing.Size(100, 25);
			this.LBH.TabIndex = 12;
			this.LBH.Text = "当代罗宾汉";
			this.LBH.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.LBH.Click += new System.EventHandler(this.LBH_Click);
			// 
			// ELS
			// 
			this.ELS.BackColor = System.Drawing.Color.Transparent;
			this.ELS.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.ELS.ForeColor = System.Drawing.Color.Tomato;
			this.ELS.Location = new System.Drawing.Point(8, 70);
			this.ELS.Name = "ELS";
			this.ELS.Size = new System.Drawing.Size(100, 25);
			this.ELS.TabIndex = 11;
			this.ELS.Text = "俄罗斯方块";
			this.ELS.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.ELS.Click += new System.EventHandler(this.ELS_Click);
			// 
			// LLK
			// 
			this.LLK.BackColor = System.Drawing.Color.Transparent;
			this.LLK.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.LLK.ForeColor = System.Drawing.Color.Tomato;
			this.LLK.Location = new System.Drawing.Point(8, 40);
			this.LLK.Name = "LLK";
			this.LLK.Size = new System.Drawing.Size(100, 25);
			this.LLK.TabIndex = 10;
			this.LLK.Text = "连 连 看";
			this.LLK.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.LLK.Click += new System.EventHandler(this.LLK_Click);
			// 
			// TCS
			// 
			this.TCS.BackColor = System.Drawing.Color.Transparent;
			this.TCS.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.TCS.ForeColor = System.Drawing.Color.Tomato;
			this.TCS.Location = new System.Drawing.Point(8, 160);
			this.TCS.Name = "TCS";
			this.TCS.Size = new System.Drawing.Size(100, 25);
			this.TCS.TabIndex = 14;
			this.TCS.Text = "贪  吃  蛇";
			this.TCS.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.TCS.Click += new System.EventHandler(this.TCS_Click);
			// 
			// MainForm
			// 
			this.AcceptButton = this.AboutMe;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("$this.BackgroundImage")));
			this.CancelButton = this.GameExit;
			this.ClientSize = new System.Drawing.Size(492, 373);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.TCS,
																		  this.ZHZ,
																		  this.LBH,
																		  this.ELS,
																		  this.LLK,
																		  this.labelExplain,
																		  this.AboutMe,
																		  this.GameExit,
																		  this.labelTile});
			this.MaximizeBox = false;
			this.MaximumSize = new System.Drawing.Size(500, 400);
			this.MinimumSize = new System.Drawing.Size(500, 400);
			this.Name = "MainForm";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "自娱自乐 版权所有:期待";
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new MainForm());
		}

		private void GameExit_Click(object sender, System.EventArgs e)
		{
			Application.Exit() ;
		}

		private void AboutMe_Click(object sender, System.EventArgs e)
		{
			AboutForm About = new AboutForm() ;
			About.Show() ;
		}

		private void LLK_Click(object sender, System.EventArgs e)
		{
			LLKForm LLK	= new LLKForm() ;
			LLK.Show();
		}

		private void ELS_Click(object sender, System.EventArgs e)
		{
			ELSForm ELS = new ELSForm() ;
			ELS.Show();
		}

		private void LBH_Click(object sender, System.EventArgs e)
		{
			LBHForm LBH = new LBHForm() ;
			LBH.Show() ;
		}

		private void ZHZ_Click(object sender, System.EventArgs e)
		{
			ZHZForm ZHZ = new ZHZForm() ;
			ZHZ.Show();
		}

		private void SJ_Click(object sender, System.EventArgs e)
		{
			SJForm SJ   = new SJForm() ;
			SJ.Show();
		}

		private void TCS_Click(object sender, System.EventArgs e)
		{
			TCSForm TCS = new TCSForm() ;
			TCS.Show();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -