📄 loginui.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using ShowInfoLibrary;
using ConnectDBLibrary;
namespace UI
{
/// <summary>
/// LoginUI 的摘要说明。
/// </summary>
public class LoginUI : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textName;
private System.Windows.Forms.TextBox textPass;
private System.Windows.Forms.Button btnLogin;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public LoginUI()
{
//
// 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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(LoginUI));
this.textName = new System.Windows.Forms.TextBox();
this.textPass = new System.Windows.Forms.TextBox();
this.btnLogin = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textName
//
this.textName.BackColor = System.Drawing.Color.White;
this.textName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textName.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.textName.Location = new System.Drawing.Point(108, 20);
this.textName.Name = "textName";
this.textName.Size = new System.Drawing.Size(104, 23);
this.textName.TabIndex = 0;
this.textName.Text = "aaaaaa";
//
// textPass
//
this.textPass.BackColor = System.Drawing.Color.White;
this.textPass.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textPass.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.textPass.Location = new System.Drawing.Point(108, 56);
this.textPass.Name = "textPass";
this.textPass.PasswordChar = '*';
this.textPass.Size = new System.Drawing.Size(104, 23);
this.textPass.TabIndex = 1;
this.textPass.Text = "aaaaaa";
//
// btnLogin
//
this.btnLogin.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnLogin.BackgroundImage")));
this.btnLogin.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnLogin.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnLogin.Location = new System.Drawing.Point(20, 96);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(75, 28);
this.btnLogin.TabIndex = 3;
this.btnLogin.Text = "登陆";
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
//
// btnExit
//
this.btnExit.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnExit.BackgroundImage")));
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
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(156, 96);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(75, 28);
this.btnExit.TabIndex = 4;
this.btnExit.Text = "退出";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// label2
//
this.label2.AutoSize = true;
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(32, 20);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(88, 22);
this.label2.TabIndex = 6;
this.label2.Text = "登陆名称:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.Location = new System.Drawing.Point(32, 60);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(88, 22);
this.label3.TabIndex = 6;
this.label3.Text = "用户密码:";
//
// LoginUI
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(258, 135);
this.Controls.Add(this.textName);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnLogin);
this.Controls.Add(this.textPass);
this.Controls.Add(this.label3);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "LoginUI";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "酒店管理登陆";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// login
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnLogin_Click(object sender, System.EventArgs e)
{
try
{
string name=this.textName.Text;
string pass=this.textPass.Text;
AdminLogin login=new AdminLogin();
if(!login.CheckedLogin(name,pass))
{
return;
}
if(login.ShowSelect(name,pass))
{
IndexUI index=new IndexUI(name);
index.WindowState = FormWindowState.Maximized;
index.Show();
this.Visible=false;
}
else
{
MessageBox.Show(null,"登陆名或密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void btnExit_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -