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

📄 startat.cs

📁 这个程序是基于c#平台的俄罗斯方框游戏。拿来共享。要求加分哦!
💻 CS
字号:


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace AnotherBlock
{
	/// <summary>
	/// Start At dialog.
	/// </summary>
	public class StartAt : System.Windows.Forms.Form
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		/// <summary>
		/// Label with the text "Start at level: ".
		/// </summary>
		private System.Windows.Forms.Label lblTextStartAtLevel;
		/// <summary>
		/// Numeric text box with the level to start at.
		/// </summary>
		private System.Windows.Forms.NumericUpDown txtLevelStart;
		/// <summary>
		/// "Ok" button.
		/// </summary>
		private System.Windows.Forms.Button butOk;
		/// <summary>
		/// "Cancel" button.
		/// </summary>
		private System.Windows.Forms.Button butCancel;

		/// <summary>
		/// Private attribute that holds the chosen game level.
		/// </summary>
		private short level;

		/// <summary>
		/// Class constructor that creates the Start At dialog.
		/// </summary>
		public StartAt()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			// Resets the chosen level to zero.
			level = 0;
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(StartAt));
			this.lblTextStartAtLevel = new System.Windows.Forms.Label();
			this.txtLevelStart = new System.Windows.Forms.NumericUpDown();
			this.butOk = new System.Windows.Forms.Button();
			this.butCancel = new System.Windows.Forms.Button();
			((System.ComponentModel.ISupportInitialize)(this.txtLevelStart)).BeginInit();
			this.SuspendLayout();
			// 
			// lblTextStartAtLevel
			// 
			this.lblTextStartAtLevel.AccessibleDescription = resources.GetString("lblTextStartAtLevel.AccessibleDescription");
			this.lblTextStartAtLevel.AccessibleName = resources.GetString("lblTextStartAtLevel.AccessibleName");
			this.lblTextStartAtLevel.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblTextStartAtLevel.Anchor")));
			this.lblTextStartAtLevel.AutoSize = ((bool)(resources.GetObject("lblTextStartAtLevel.AutoSize")));
			this.lblTextStartAtLevel.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblTextStartAtLevel.Dock")));
			this.lblTextStartAtLevel.Enabled = ((bool)(resources.GetObject("lblTextStartAtLevel.Enabled")));
			this.lblTextStartAtLevel.Font = ((System.Drawing.Font)(resources.GetObject("lblTextStartAtLevel.Font")));
			this.lblTextStartAtLevel.Image = ((System.Drawing.Image)(resources.GetObject("lblTextStartAtLevel.Image")));
			this.lblTextStartAtLevel.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblTextStartAtLevel.ImageAlign")));
			this.lblTextStartAtLevel.ImageIndex = ((int)(resources.GetObject("lblTextStartAtLevel.ImageIndex")));
			this.lblTextStartAtLevel.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblTextStartAtLevel.ImeMode")));
			this.lblTextStartAtLevel.Location = ((System.Drawing.Point)(resources.GetObject("lblTextStartAtLevel.Location")));
			this.lblTextStartAtLevel.Name = "lblTextStartAtLevel";
			this.lblTextStartAtLevel.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblTextStartAtLevel.RightToLeft")));
			this.lblTextStartAtLevel.Size = ((System.Drawing.Size)(resources.GetObject("lblTextStartAtLevel.Size")));
			this.lblTextStartAtLevel.TabIndex = ((int)(resources.GetObject("lblTextStartAtLevel.TabIndex")));
			this.lblTextStartAtLevel.Text = resources.GetString("lblTextStartAtLevel.Text");
			this.lblTextStartAtLevel.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblTextStartAtLevel.TextAlign")));
			this.lblTextStartAtLevel.Visible = ((bool)(resources.GetObject("lblTextStartAtLevel.Visible")));
			// 
			// txtLevelStart
			// 
			this.txtLevelStart.AccessibleDescription = resources.GetString("txtLevelStart.AccessibleDescription");
			this.txtLevelStart.AccessibleName = resources.GetString("txtLevelStart.AccessibleName");
			this.txtLevelStart.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtLevelStart.Anchor")));
			this.txtLevelStart.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtLevelStart.Dock")));
			this.txtLevelStart.Enabled = ((bool)(resources.GetObject("txtLevelStart.Enabled")));
			this.txtLevelStart.Font = ((System.Drawing.Font)(resources.GetObject("txtLevelStart.Font")));
			this.txtLevelStart.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtLevelStart.ImeMode")));
			this.txtLevelStart.Location = ((System.Drawing.Point)(resources.GetObject("txtLevelStart.Location")));
			this.txtLevelStart.Minimum = new System.Decimal(new int[] {
																		  1,
																		  0,
																		  0,
																		  0});
			this.txtLevelStart.Name = "txtLevelStart";
			this.txtLevelStart.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtLevelStart.RightToLeft")));
			this.txtLevelStart.Size = ((System.Drawing.Size)(resources.GetObject("txtLevelStart.Size")));
			this.txtLevelStart.TabIndex = ((int)(resources.GetObject("txtLevelStart.TabIndex")));
			this.txtLevelStart.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtLevelStart.TextAlign")));
			this.txtLevelStart.ThousandsSeparator = ((bool)(resources.GetObject("txtLevelStart.ThousandsSeparator")));
			this.txtLevelStart.UpDownAlign = ((System.Windows.Forms.LeftRightAlignment)(resources.GetObject("txtLevelStart.UpDownAlign")));
			this.txtLevelStart.Value = new System.Decimal(new int[] {
																		1,
																		0,
																		0,
																		0});
			this.txtLevelStart.Visible = ((bool)(resources.GetObject("txtLevelStart.Visible")));
			// 
			// butOk
			// 
			this.butOk.AccessibleDescription = resources.GetString("butOk.AccessibleDescription");
			this.butOk.AccessibleName = resources.GetString("butOk.AccessibleName");
			this.butOk.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("butOk.Anchor")));
			this.butOk.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("butOk.BackgroundImage")));
			this.butOk.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("butOk.Dock")));
			this.butOk.Enabled = ((bool)(resources.GetObject("butOk.Enabled")));
			this.butOk.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("butOk.FlatStyle")));
			this.butOk.Font = ((System.Drawing.Font)(resources.GetObject("butOk.Font")));
			this.butOk.Image = ((System.Drawing.Image)(resources.GetObject("butOk.Image")));
			this.butOk.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("butOk.ImageAlign")));
			this.butOk.ImageIndex = ((int)(resources.GetObject("butOk.ImageIndex")));
			this.butOk.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("butOk.ImeMode")));
			this.butOk.Location = ((System.Drawing.Point)(resources.GetObject("butOk.Location")));
			this.butOk.Name = "butOk";
			this.butOk.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("butOk.RightToLeft")));
			this.butOk.Size = ((System.Drawing.Size)(resources.GetObject("butOk.Size")));
			this.butOk.TabIndex = ((int)(resources.GetObject("butOk.TabIndex")));
			this.butOk.Text = resources.GetString("butOk.Text");
			this.butOk.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("butOk.TextAlign")));
			this.butOk.Visible = ((bool)(resources.GetObject("butOk.Visible")));
			this.butOk.Click += new System.EventHandler(this.butOk_Click);
			// 
			// butCancel
			// 
			this.butCancel.AccessibleDescription = resources.GetString("butCancel.AccessibleDescription");
			this.butCancel.AccessibleName = resources.GetString("butCancel.AccessibleName");
			this.butCancel.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("butCancel.Anchor")));
			this.butCancel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("butCancel.BackgroundImage")));
			this.butCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.butCancel.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("butCancel.Dock")));
			this.butCancel.Enabled = ((bool)(resources.GetObject("butCancel.Enabled")));
			this.butCancel.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("butCancel.FlatStyle")));
			this.butCancel.Font = ((System.Drawing.Font)(resources.GetObject("butCancel.Font")));
			this.butCancel.Image = ((System.Drawing.Image)(resources.GetObject("butCancel.Image")));
			this.butCancel.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("butCancel.ImageAlign")));
			this.butCancel.ImageIndex = ((int)(resources.GetObject("butCancel.ImageIndex")));
			this.butCancel.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("butCancel.ImeMode")));
			this.butCancel.Location = ((System.Drawing.Point)(resources.GetObject("butCancel.Location")));
			this.butCancel.Name = "butCancel";
			this.butCancel.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("butCancel.RightToLeft")));
			this.butCancel.Size = ((System.Drawing.Size)(resources.GetObject("butCancel.Size")));
			this.butCancel.TabIndex = ((int)(resources.GetObject("butCancel.TabIndex")));
			this.butCancel.Text = resources.GetString("butCancel.Text");
			this.butCancel.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("butCancel.TextAlign")));
			this.butCancel.Visible = ((bool)(resources.GetObject("butCancel.Visible")));
			this.butCancel.Click += new System.EventHandler(this.butCancel_Click);
			// 
			// StartAt
			// 
			this.AcceptButton = this.butOk;
			this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
			this.AccessibleName = resources.GetString("$this.AccessibleName");
			this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));
			this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
			this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
			this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.CancelButton = this.butCancel;
			this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
			this.Controls.Add(this.butCancel);
			this.Controls.Add(this.butOk);
			this.Controls.Add(this.txtLevelStart);
			this.Controls.Add(this.lblTextStartAtLevel);
			this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
			this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
			this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
			this.MaximizeBox = false;
			this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
			this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
			this.Name = "StartAt";
			this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
			this.ShowInTaskbar = false;
			this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
			this.Text = resources.GetString("$this.Text");
			((System.ComponentModel.ISupportInitialize)(this.txtLevelStart)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The click of the "Ok" button. Sets the level attribute with the chosen level and closes the dialog.
		/// </summary>
		/// <param name="sender">The parent control who triggered the event.</param>
		/// <param name="e">Default event arguments.</param>
		private void butOk_Click(object sender, System.EventArgs e)
		{
			// Sets the level attribute to the chosen level.
			level = (short)(txtLevelStart.Value);
			// Closes the dialog.
			this.Close();
		}

		/// <summary>
		/// The click of the "Cancel" button. Closes the dialog.
		/// </summary>
		/// <param name="sender">The parent control who triggered the event.</param>
		/// <param name="e">Default event arguments.</param>
		private void butCancel_Click(object sender, System.EventArgs e)
		{
			// Closes the dialog.
			this.Close();
		}

		/// <summary>
		/// Readonly property that holds the chosen level.
		/// </summary>
		public short Level
		{
			get
			{
				// Returns the value in the level attribute.
				return level;
			}
		}
	}
}

⌨️ 快捷键说明

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