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

📄 form1.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 Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button button9;
		private System.Windows.Forms.Button button10;
		private System.Windows.Forms.Button button11;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.Button button4;
		private System.Windows.Forms.Button button5;
		private System.Windows.Forms.Button button6;
		private System.Windows.Forms.Button button7;
		private System.Windows.Forms.Button button8;
		private System.Windows.Forms.Button button12;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Button button13;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

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

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


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

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.button9 = new System.Windows.Forms.Button();
			this.button10 = new System.Windows.Forms.Button();
			this.button11 = new System.Windows.Forms.Button();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.button3 = new System.Windows.Forms.Button();
			this.button4 = new System.Windows.Forms.Button();
			this.button5 = new System.Windows.Forms.Button();
			this.button6 = new System.Windows.Forms.Button();
			this.button7 = new System.Windows.Forms.Button();
			this.button8 = new System.Windows.Forms.Button();
			this.button12 = new System.Windows.Forms.Button();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.button13 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// button9
			// 
			this.button9.Image = ((System.Drawing.Image)(resources.GetObject("button9.Image")));
			this.button9.Location = new System.Drawing.Point(0, 386);
			this.button9.Name = "button9";
			this.button9.Size = new System.Drawing.Size(43, 42);
			this.button9.TabIndex = 8;
			this.button9.Click += new System.EventHandler(this.button9_Click);
			// 
			// button10
			// 
			this.button10.Image = ((System.Drawing.Image)(resources.GetObject("button10.Image")));
			this.button10.Location = new System.Drawing.Point(43, 386);
			this.button10.Name = "button10";
			this.button10.Size = new System.Drawing.Size(43, 42);
			this.button10.TabIndex = 9;
			this.button10.Click += new System.EventHandler(this.button10_Click);
			// 
			// button11
			// 
			this.button11.Image = ((System.Drawing.Image)(resources.GetObject("button11.Image")));
			this.button11.Location = new System.Drawing.Point(43, 470);
			this.button11.Name = "button11";
			this.button11.Size = new System.Drawing.Size(43, 42);
			this.button11.TabIndex = 10;
			this.button11.Click += new System.EventHandler(this.button11_Click);
			// 
			// button1
			// 
			this.button1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button1.BackgroundImage")));
			this.button1.Location = new System.Drawing.Point(129, 386);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(43, 42);
			this.button1.TabIndex = 11;
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
			this.button2.Location = new System.Drawing.Point(86, 470);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(43, 42);
			this.button2.TabIndex = 12;
			this.button2.Click += new System.EventHandler(this.button2_Click_1);
			// 
			// button3
			// 
			this.button3.Image = ((System.Drawing.Image)(resources.GetObject("button3.Image")));
			this.button3.Location = new System.Drawing.Point(0, 428);
			this.button3.Name = "button3";
			this.button3.Size = new System.Drawing.Size(43, 42);
			this.button3.TabIndex = 13;
			this.button3.Click += new System.EventHandler(this.button3_Click_1);
			// 
			// button4
			// 
			this.button4.Image = ((System.Drawing.Image)(resources.GetObject("button4.Image")));
			this.button4.Location = new System.Drawing.Point(86, 386);
			this.button4.Name = "button4";
			this.button4.Size = new System.Drawing.Size(43, 42);
			this.button4.TabIndex = 14;
			this.button4.Click += new System.EventHandler(this.button4_Click_1);
			// 
			// button5
			// 
			this.button5.Image = ((System.Drawing.Image)(resources.GetObject("button5.Image")));
			this.button5.Location = new System.Drawing.Point(43, 428);
			this.button5.Name = "button5";
			this.button5.Size = new System.Drawing.Size(43, 42);
			this.button5.TabIndex = 15;
			this.button5.Click += new System.EventHandler(this.button5_Click);
			// 
			// button6
			// 
			this.button6.Image = ((System.Drawing.Image)(resources.GetObject("button6.Image")));
			this.button6.Location = new System.Drawing.Point(0, 470);
			this.button6.Name = "button6";
			this.button6.Size = new System.Drawing.Size(43, 42);
			this.button6.TabIndex = 16;
			this.button6.Click += new System.EventHandler(this.button6_Click);
			// 
			// button7
			// 
			this.button7.Image = ((System.Drawing.Image)(resources.GetObject("button7.Image")));
			this.button7.Location = new System.Drawing.Point(86, 428);
			this.button7.Name = "button7";
			this.button7.Size = new System.Drawing.Size(43, 42);
			this.button7.TabIndex = 17;
			this.button7.Click += new System.EventHandler(this.button7_Click);
			// 
			// button8
			// 
			this.button8.Image = ((System.Drawing.Image)(resources.GetObject("button8.Image")));
			this.button8.Location = new System.Drawing.Point(129, 428);
			this.button8.Name = "button8";
			this.button8.Size = new System.Drawing.Size(43, 84);
			this.button8.TabIndex = 18;
			this.button8.Click += new System.EventHandler(this.button8_Click);
			// 
			// button12
			// 
			this.button12.Image = ((System.Drawing.Image)(resources.GetObject("button12.Image")));
			this.button12.Location = new System.Drawing.Point(172, 428);
			this.button12.Name = "button12";
			this.button12.Size = new System.Drawing.Size(43, 84);
			this.button12.TabIndex = 19;
			this.button12.Click += new System.EventHandler(this.button12_Click);
			// 
			// textBox1
			// 
			this.textBox1.Location = new System.Drawing.Point(216, 260);
			this.textBox1.Name = "textBox1";
			this.textBox1.PasswordChar = '*';
			this.textBox1.Size = new System.Drawing.Size(136, 21);
			this.textBox1.TabIndex = 20;
			this.textBox1.Text = "";
			this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown);
			// 
			// button13
			// 
			this.button13.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button13.BackgroundImage")));
			this.button13.Location = new System.Drawing.Point(172, 386);
			this.button13.Name = "button13";
			this.button13.Size = new System.Drawing.Size(43, 42);
			this.button13.TabIndex = 21;
			this.button13.Click += new System.EventHandler(this.button13_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = new System.Drawing.Size(512, 512);
			this.Controls.Add(this.button13);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.button12);
			this.Controls.Add(this.button8);
			this.Controls.Add(this.button7);
			this.Controls.Add(this.button6);
			this.Controls.Add(this.button5);
			this.Controls.Add(this.button4);
			this.Controls.Add(this.button3);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.button11);
			this.Controls.Add(this.button10);
			this.Controls.Add(this.button9);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Name = "Form1";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Load += new System.EventHandler(this.Form1_Load);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		
		private void button2_Click(object sender, System.EventArgs e)
		{
		
		}

		private void button4_Click(object sender, System.EventArgs e)
		{
		
		}

		private void button3_Click(object sender, System.EventArgs e)
		{
		
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
		
		}

		private void button2_Click_1(object sender, System.EventArgs e)
		{
			this.textBox1.Text=this.textBox1.Text+"9";
		}

		private void button11_Click(object sender, System.EventArgs e)
		{
			this.textBox1.Text=this.textBox1.Text+"8";
		}

		private void button6_Click(object sender, System.EventArgs e)
		{
			this.textBox1.Text=this.textBox1.Text+"7";
		}

		private void button9_Click(object sender, System.EventArgs e)
		{
			this.textBox1.Text=this.textBox1.Text+"1";
		}

		private void button10_Click(object sender, System.EventArgs e)
		{
			this.textBox1.Text=this.textBox1.Text+"2";

		}

		private void button4_Click_1(object sender, System.EventArgs e)
		{
			this.textBox1.Text=this.textBox1.Text+"3";
		
		}

		private void button3_Click_1(object sender, System.EventArgs e)
		{
			this.textBox1.Text=this.textBox1.Text+"4";
		}

		private void button5_Click(object sender, System.EventArgs e)
		{
			this.textBox1.Text=this.textBox1.Text+"5";
		}

		private void button7_Click(object sender, System.EventArgs e)
		{
			this.textBox1.Text=this.textBox1.Text+"6";
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			this.textBox1.Text=this.textBox1.Text+"0";
		}

		private void button13_Click(object sender, System.EventArgs e)
		{
			try
			{
				
			
				this.textBox1.Text= 
					this.textBox1.Text.Substring(0,this.textBox1.Text.Length-1); 
			
			}
			catch
			{
                   MessageBox.Show("请输入密码");
			}
			
		
		}

		private void button8_Click(object sender, System.EventArgs e)
		{
			if(this.textBox1.Text.Length!=6)
			{
				MessageBox.Show("请输入6位数的密码!");
			}
			else 
			{
				if(this.textBox1.Text=="048523")
				{
					
					this.Close();


				}
				else
				{
					MessageBox.Show("密码错误!");
				}
			}
		}

		private void button12_Click(object sender, System.EventArgs e)
		{
			if(this.textBox1.Text=="")
			{
				if(MessageBox.Show("您确定要退出吗?","exit",MessageBoxButtons.YesNo)==DialogResult.Yes)
				{
					Application.Exit();
				}
				
			}
			else
			{
				this.textBox1.Text="";
			}
		}

		private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			MessageBox.Show("请用系统自带的软件盘输入!");
			this.textBox1.Text="";
		}
	}
}

⌨️ 快捷键说明

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