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

📄 login.cs

📁 为湖北省教委、湖北省就业指导中心订做的学历查询系统
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace WindowsApplication3
{
	/// <summary>
	/// Form2 的摘要说明。
	/// </summary>
	public class Form2 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TextBox txtName;
		private System.Windows.Forms.TextBox txtPassword;
		private System.Windows.Forms.ToolTip 提示;
		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.PictureBox pictureBox2;
		public static Admin adm;

		public Form2()
		{
			//
			// 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()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form2));
			this.txtName = new System.Windows.Forms.TextBox();
			this.txtPassword = new System.Windows.Forms.TextBox();
			this.提示 = new System.Windows.Forms.ToolTip(this.components);
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.pictureBox2 = new System.Windows.Forms.PictureBox();
			this.SuspendLayout();
			// 
			// txtName
			// 
			this.txtName.Location = new System.Drawing.Point(432, 208);
			this.txtName.Name = "txtName";
			this.txtName.Size = new System.Drawing.Size(112, 21);
			this.txtName.TabIndex = 0;
			this.txtName.Text = "";
			this.提示.SetToolTip(this.txtName, "请输入登陆名");
			this.txtName.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtName_KeyPress);
			// 
			// txtPassword
			// 
			this.txtPassword.Location = new System.Drawing.Point(432, 240);
			this.txtPassword.Name = "txtPassword";
			this.txtPassword.PasswordChar = '*';
			this.txtPassword.Size = new System.Drawing.Size(112, 21);
			this.txtPassword.TabIndex = 1;
			this.txtPassword.Text = "";
			this.提示.SetToolTip(this.txtPassword, "请输入密码");
			this.txtPassword.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtPassword_KeyPress);
			// 
			// pictureBox1
			// 
			this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Location = new System.Drawing.Point(496, 280);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(56, 26);
			this.pictureBox1.TabIndex = 4;
			this.pictureBox1.TabStop = false;
			this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
			this.pictureBox1.MouseEnter += new System.EventHandler(this.pictureBox1_MouseEnter);
			this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
			// 
			// pictureBox2
			// 
			this.pictureBox2.Cursor = System.Windows.Forms.Cursors.Hand;
			this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
			this.pictureBox2.Location = new System.Drawing.Point(432, 280);
			this.pictureBox2.Name = "pictureBox2";
			this.pictureBox2.Size = new System.Drawing.Size(54, 23);
			this.pictureBox2.TabIndex = 5;
			this.pictureBox2.TabStop = false;
			this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
			this.pictureBox2.MouseEnter += new System.EventHandler(this.pictureBox2_MouseEnter);
			this.pictureBox2.MouseLeave += new System.EventHandler(this.pictureBox2_MouseLeave);
			// 
			// Form2
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = new System.Drawing.Size(600, 397);
			this.Controls.Add(this.pictureBox2);
			this.Controls.Add(this.pictureBox1);
			this.Controls.Add(this.txtPassword);
			this.Controls.Add(this.txtName);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "Form2";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "湖北省就业指导中心";
			this.Closing += new System.ComponentModel.CancelEventHandler(this.Form2_Closing);
			this.SizeChanged += new System.EventHandler(this.Form2_SizeChanged);
			this.Load += new System.EventHandler(this.Form2_Load);
			this.Enter += new System.EventHandler(this.Form2_Enter);
			this.ResumeLayout(false);

		}
		#endregion

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

	

		private void Form2_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			if( this.DialogResult == DialogResult.OK )
			{

			}
			else
			{
				this.DialogResult = DialogResult.Cancel;
			}
		}


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

		private void Form2_Enter(object sender, System.EventArgs e)
		{
			txtName.Text = txtName.Text.Trim();
			txtPassword.Text = txtPassword.Text.Trim();
			adm = new Admin( txtName.Text,txtPassword.Text );
			if(adm.IsExist( ))
			{
				this.DialogResult = DialogResult.OK;
			}
			else
			{
				MessageBox.Show("用户名不存在或密码不正确!","登陆提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Information );
			}	
		}

		private void pictureBox1_MouseEnter(object sender, System.EventArgs e)
		{
			pictureBox1.Image = Image.FromFile( "img\\button-登录02.GIF");
		}

		private void pictureBox1_MouseLeave(object sender, System.EventArgs e)
		{
			pictureBox1.Image = Image.FromFile( "img\\button-登录01.GIF");
		}

		private void pictureBox2_MouseEnter(object sender, System.EventArgs e)
		{
			pictureBox2.Image = Image.FromFile( "img\\button-注册02.GIF");
		}

		private void pictureBox2_MouseLeave(object sender, System.EventArgs e)
		{
			pictureBox2.Image = Image.FromFile( "img\\button-注册01.GIF");
		}

		private void pictureBox1_Click(object sender, System.EventArgs e)
		{
			txtName.Text = txtName.Text.Trim();
			txtPassword.Text = txtPassword.Text.Trim();
			adm = new Admin( txtName.Text,txtPassword.Text );
			if(adm.IsExist( ))
			{
				this.DialogResult = DialogResult.OK;
			}
			else
			{
				MessageBox.Show("用户名不存在或密码不正确!","登陆提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Information );
			}
		}

		private void pictureBox2_Click(object sender, System.EventArgs e)
		{
			Register frmReg = new Register();
			frmReg.ShowDialog();
		}

		private void txtPassword_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if ( e.KeyChar == 13 )
			{
				pictureBox1_Click( sender, e );
			}
		}

		private void txtName_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			if ( e.KeyChar == 13 )
			{
				pictureBox1_Click( sender, e );
			}
		}
	}
}

⌨️ 快捷键说明

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