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

📄 logon.cs

📁 问题定义 随着生活水平的日益提高
💻 CS
字号:
using System;
using System.Drawing;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace 通讯录
{
	/// <summary>
	/// logon 的摘要说明。
	/// </summary>
	public class logon : System.Windows.Forms.Form
	{
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.Button btnexit;
		private System.Windows.Forms.Button btnok;
		private System.Windows.Forms.TextBox txtid;
		private System.Windows.Forms.TextBox txtpwd;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label userid;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public logon()
		{
			//
			// 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.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.btnexit = new System.Windows.Forms.Button();
			this.btnok = new System.Windows.Forms.Button();
			this.txtid = new System.Windows.Forms.TextBox();
			this.txtpwd = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.userid = new System.Windows.Forms.Label();
			this.SuspendLayout();
			// 
			// pictureBox1
			// 
			this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.pictureBox1.Location = new System.Drawing.Point(0, 0);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(272, 229);
			this.pictureBox1.TabIndex = 0;
			this.pictureBox1.TabStop = false;
			// 
			// btnexit
			// 
			this.btnexit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.btnexit.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnexit.Location = new System.Drawing.Point(152, 168);
			this.btnexit.Name = "btnexit";
			this.btnexit.Size = new System.Drawing.Size(88, 37);
			this.btnexit.TabIndex = 4;
			this.btnexit.Text = "Exit";
			this.btnexit.Click += new System.EventHandler(this.btnexit_Click);
			// 
			// btnok
			// 
			this.btnok.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnok.Location = new System.Drawing.Point(24, 168);
			this.btnok.Name = "btnok";
			this.btnok.Size = new System.Drawing.Size(85, 37);
			this.btnok.TabIndex = 3;
			this.btnok.Text = "Ok";
			this.btnok.Click += new System.EventHandler(this.btnok_Click);
			// 
			// txtid
			// 
			this.txtid.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.txtid.Location = new System.Drawing.Point(128, 40);
			this.txtid.Name = "txtid";
			this.txtid.Size = new System.Drawing.Size(112, 26);
			this.txtid.TabIndex = 1;
			this.txtid.Text = "";
			// 
			// txtpwd
			// 
			this.txtpwd.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.txtpwd.Location = new System.Drawing.Point(128, 108);
			this.txtpwd.Name = "txtpwd";
			this.txtpwd.Size = new System.Drawing.Size(112, 26);
			this.txtpwd.TabIndex = 2;
			this.txtpwd.Text = "";
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label2.Location = new System.Drawing.Point(24, 112);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(88, 32);
			this.label2.TabIndex = 7;
			this.label2.Text = "Passwd:";
			// 
			// userid
			// 
			this.userid.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.userid.Location = new System.Drawing.Point(24, 40);
			this.userid.Name = "userid";
			this.userid.Size = new System.Drawing.Size(88, 32);
			this.userid.TabIndex = 6;
			this.userid.Text = "UserID:";
			// 
			// logon
			// 
			this.AcceptButton = this.btnok;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.CancelButton = this.btnexit;
			this.ClientSize = new System.Drawing.Size(272, 229);
			this.Controls.Add(this.btnexit);
			this.Controls.Add(this.btnok);
			this.Controls.Add(this.txtid);
			this.Controls.Add(this.txtpwd);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.userid);
			this.Controls.Add(this.pictureBox1);
			this.Name = "logon";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "登录";
			this.ResumeLayout(false);

		}
		#endregion

        #region "用户登录"
		private void btnok_Click(object sender, System.EventArgs e)
		{
			int x=0;       
			Classdb userlogon=new Classdb();
			md5eny md5=new md5eny();
			string id=txtid.Text.Trim();
			string pwd=md5.getmd5(txtpwd.Text.Trim());
			x=userlogon.uservalid(id,pwd);
			if (x!=0)
			{
				MessageBox.Show("登录成功!");
                var varlevel=new var();
				varlevel.varlev(x.ToString());
				this.Dispose();
			}
               else
			{
				MessageBox.Show("用户名或密码错误,请重新输入!");
			}
		
		}
#endregion


		private void btnexit_Click(object sender, System.EventArgs e)
		{
			 this.Dispose(); //退出
		}
	}
}

⌨️ 快捷键说明

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