📄 login.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace personal
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class login : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pbtop;
private System.Windows.Forms.Label lalusername;
private System.Windows.Forms.Label lalpassword;
private System.Windows.Forms.TextBox txtusername;
private System.Windows.Forms.TextBox txtpassword;
private System.Windows.Forms.Button btnloginin;
private System.Windows.Forms.Button btnloginout;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public login()
{
//
// 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(login));
this.pbtop = new System.Windows.Forms.PictureBox();
this.lalusername = new System.Windows.Forms.Label();
this.lalpassword = new System.Windows.Forms.Label();
this.txtusername = new System.Windows.Forms.TextBox();
this.txtpassword = new System.Windows.Forms.TextBox();
this.btnloginin = new System.Windows.Forms.Button();
this.btnloginout = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// pbtop
//
this.pbtop.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pbtop.BackgroundImage")));
this.pbtop.Location = new System.Drawing.Point(0, 0);
this.pbtop.Name = "pbtop";
this.pbtop.Size = new System.Drawing.Size(360, 50);
this.pbtop.TabIndex = 0;
this.pbtop.TabStop = false;
//
// lalusername
//
this.lalusername.Location = new System.Drawing.Point(32, 80);
this.lalusername.Name = "lalusername";
this.lalusername.Size = new System.Drawing.Size(104, 24);
this.lalusername.TabIndex = 1;
this.lalusername.Text = "登陆用户";
//
// lalpassword
//
this.lalpassword.Location = new System.Drawing.Point(32, 112);
this.lalpassword.Name = "lalpassword";
this.lalpassword.Size = new System.Drawing.Size(104, 24);
this.lalpassword.TabIndex = 2;
this.lalpassword.Text = "登陆密码";
//
// txtusername
//
this.txtusername.Location = new System.Drawing.Point(152, 80);
this.txtusername.Name = "txtusername";
this.txtusername.Size = new System.Drawing.Size(160, 21);
this.txtusername.TabIndex = 3;
this.txtusername.Text = "";
//
// txtpassword
//
this.txtpassword.Location = new System.Drawing.Point(152, 112);
this.txtpassword.Name = "txtpassword";
this.txtpassword.PasswordChar = '*';
this.txtpassword.Size = new System.Drawing.Size(160, 21);
this.txtpassword.TabIndex = 4;
this.txtpassword.Text = "";
//
// btnloginin
//
this.btnloginin.Location = new System.Drawing.Point(56, 152);
this.btnloginin.Name = "btnloginin";
this.btnloginin.Size = new System.Drawing.Size(72, 24);
this.btnloginin.TabIndex = 5;
this.btnloginin.Text = "登陆";
this.btnloginin.Click += new System.EventHandler(this.btnloginin_Click);
//
// btnloginout
//
this.btnloginout.Location = new System.Drawing.Point(200, 152);
this.btnloginout.Name = "btnloginout";
this.btnloginout.Size = new System.Drawing.Size(72, 24);
this.btnloginout.TabIndex = 6;
this.btnloginout.Text = "退出";
this.btnloginout.Click += new System.EventHandler(this.btnloginout_Click);
//
// login
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(235)), ((System.Byte)(246)), ((System.Byte)(255)));
this.ClientSize = new System.Drawing.Size(350, 214);
this.Controls.Add(this.btnloginout);
this.Controls.Add(this.btnloginin);
this.Controls.Add(this.txtpassword);
this.Controls.Add(this.txtusername);
this.Controls.Add(this.lalpassword);
this.Controls.Add(this.lalusername);
this.Controls.Add(this.pbtop);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(360, 250);
this.MinimumSize = new System.Drawing.Size(360, 250);
this.Name = "login";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "个人信息管理系统";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new login());
}
private void btnloginout_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void btnloginin_Click(object sender, System.EventArgs e)
{
datalink mydatalink = new datalink();
if (txtusername.Text==""||txtpassword.Text=="")
{
MessageBox.Show("你的登陆用户或登陆密码没填!\n","登陆失败",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else
{
if(mydatalink.checkname(txtusername.Text,txtpassword.Text))
{
personalfrm mypersonal=new personalfrm();
mypersonal.Show();
this.Close();
}
else
{
MessageBox.Show("你的登陆用户或登陆密码错误!\n","登陆失败",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -