?? longinform.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 + -