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

📄 longinform.cs

📁 仓库管理系统源代码 c#+sql2000
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;


namespace WindowsApplication4
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class LongInForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label4;
		public static bool lfstate=false;
		private System.Windows.Forms.TextBox textPwd;
		private System.Windows.Forms.TextBox textID;
		private System.Windows.Forms.Button sure_button;
		private System.Windows.Forms.Button esc_button;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public LongInForm()
		{
			//
			// 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.groupBox1 = new System.Windows.Forms.GroupBox();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.label4 = new System.Windows.Forms.Label();
			this.textPwd = new System.Windows.Forms.TextBox();
			this.textID = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.sure_button = new System.Windows.Forms.Button();
			this.esc_button = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.groupBox2);
			this.groupBox1.Controls.Add(this.textPwd);
			this.groupBox1.Controls.Add(this.textID);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Location = new System.Drawing.Point(24, 32);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(248, 160);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.label4);
			this.groupBox2.Location = new System.Drawing.Point(8, 112);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(232, 40);
			this.groupBox2.TabIndex = 4;
			this.groupBox2.TabStop = false;
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(16, 17);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(208, 16);
			this.label4.TabIndex = 0;
			this.label4.Text = "初始用户ID:admin,密码:admin";
			// 
			// textPwd
			// 
			this.textPwd.Location = new System.Drawing.Point(96, 70);
			this.textPwd.Name = "textPwd";
			this.textPwd.PasswordChar = '*';
			this.textPwd.Size = new System.Drawing.Size(96, 21);
			this.textPwd.TabIndex = 3;
			this.textPwd.Text = "";
			// 
			// textID
			// 
			this.textID.Location = new System.Drawing.Point(96, 24);
			this.textID.Name = "textID";
			this.textID.Size = new System.Drawing.Size(96, 21);
			this.textID.TabIndex = 2;
			this.textID.Text = "";
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label3.Location = new System.Drawing.Point(24, 72);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(48, 16);
			this.label3.TabIndex = 1;
			this.label3.Text = "*密码";
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label2.Location = new System.Drawing.Point(24, 32);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(56, 16);
			this.label2.TabIndex = 0;
			this.label2.Text = "*用户ID:";
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label1.Location = new System.Drawing.Point(72, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(144, 24);
			this.label1.TabIndex = 1;
			this.label1.Text = "欢迎使用本系统";
			// 
			// sure_button
			// 
			this.sure_button.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.sure_button.Location = new System.Drawing.Point(64, 200);
			this.sure_button.Name = "sure_button";
			this.sure_button.Size = new System.Drawing.Size(72, 24);
			this.sure_button.TabIndex = 2;
			this.sure_button.Text = "确定";
			this.sure_button.Click += new System.EventHandler(this.button1_Click);
			// 
			// esc_button
			// 
			this.esc_button.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.esc_button.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.esc_button.Location = new System.Drawing.Point(168, 200);
			this.esc_button.Name = "esc_button";
			this.esc_button.Size = new System.Drawing.Size(72, 24);
			this.esc_button.TabIndex = 3;
			this.esc_button.Text = "取消";
			this.esc_button.Click += new System.EventHandler(this.button2_Click);
			// 
			// LongInForm
			// 
			this.AcceptButton = this.sure_button;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.CancelButton = this.esc_button;
			this.ClientSize = new System.Drawing.Size(296, 238);
			this.Controls.Add(this.esc_button);
			this.Controls.Add(this.sure_button);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.groupBox1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "LongInForm";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "登录系统";
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		

		private void button1_Click(object sender, System.EventArgs e)
		{
			if( this.textID.Text.Trim() == string.Empty || this.textPwd.Text.Trim() == string.Empty )//没有输入用户ID和密码
			{
				MessageBox.Show("请输入用户ID,密码!");
				return;
			}
			LonIn User = new LonIn();
			User.UserID = this.textID.Text.Trim();
			User.PassWord = this.textPwd.Text.Trim();
			int intResult  = User.isUser();//得到返回值
			if( intResult == 1 )//ID和密码完全正确
			{    
				lfstate= true;
				this.Close();
				return;
			}
			else
			{
				MessageBox.Show("您输入的用户ID或密码不正确!");
				return;
			}
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			lfstate=false;
			this.Close();
		}
	}
}

⌨️ 快捷键说明

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