loadform.cs

来自「初学Csharp」· CS 代码 · 共 177 行

CS
177
字号
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace SourceManager
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class LoadForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox textBox_userID;
		private System.Windows.Forms.TextBox textBox_pwd;
		private System.Windows.Forms.Button button_OK;
		private System.Windows.Forms.Button button_cancel;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
        
		public LoadForm()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <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()
		{
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.textBox_userID = new System.Windows.Forms.TextBox();
			this.textBox_pwd = new System.Windows.Forms.TextBox();
			this.button_OK = new System.Windows.Forms.Button();
			this.button_cancel = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("SimSun", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label1.Location = new System.Drawing.Point(56, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(80, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "用户名";
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("SimSun", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label2.Location = new System.Drawing.Point(56, 72);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(80, 16);
			this.label2.TabIndex = 1;
			this.label2.Text = "密码";
			// 
			// textBox_userID
			// 
			this.textBox_userID.Location = new System.Drawing.Point(144, 27);
			this.textBox_userID.Name = "textBox_userID";
			this.textBox_userID.Size = new System.Drawing.Size(104, 21);
			this.textBox_userID.TabIndex = 2;
			this.textBox_userID.Text = "";
			// 
			// textBox_pwd
			// 
			this.textBox_pwd.Location = new System.Drawing.Point(144, 66);
			this.textBox_pwd.Name = "textBox_pwd";
			this.textBox_pwd.PasswordChar = '*';
			this.textBox_pwd.Size = new System.Drawing.Size(104, 21);
			this.textBox_pwd.TabIndex = 3;
			this.textBox_pwd.Text = "";
			// 
			// button_OK
			// 
			this.button_OK.Location = new System.Drawing.Point(88, 112);
			this.button_OK.Name = "button_OK";
			this.button_OK.Size = new System.Drawing.Size(64, 24);
			this.button_OK.TabIndex = 4;
			this.button_OK.Text = "确定";
			this.button_OK.Click += new System.EventHandler(this.button_OK_Click);
			// 
			// button_cancel
			// 
			this.button_cancel.Location = new System.Drawing.Point(152, 112);
			this.button_cancel.Name = "button_cancel";
			this.button_cancel.Size = new System.Drawing.Size(64, 24);
			this.button_cancel.TabIndex = 5;
			this.button_cancel.Text = "取消";
			this.button_cancel.Click += new System.EventHandler(this.button_cancel_Click);
			// 
			// LoadForm
			// 
			this.AcceptButton = this.button_OK;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(304, 165);
			this.Controls.Add(this.button_cancel);
			this.Controls.Add(this.button_OK);
			this.Controls.Add(this.textBox_pwd);
			this.Controls.Add(this.textBox_userID);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.Name = "LoadForm";
			this.Text = "用户登录";
			this.Load += new System.EventHandler(this.LoadForm_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void button_OK_Click(object sender, System.EventArgs e)
		{
			//验证身份

			//
			this.Close();
 

		}

		private void button_cancel_Click(object sender, System.EventArgs e)
		{
			this.Close(); 
		}

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

		}

		public string usrname
		{
			get
			{
				return this.textBox_userID.Text;
			}
		}

		public string password
		{
			get
			{
				return this.textBox_pwd.Text;
			}
		}
	}
}

⌨️ 快捷键说明

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