?? login.cs
字號(hào):
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace WindowsApplication3
{
/// <summary>
/// Form2 的摘要說(shuō)明。
/// </summary>
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.ToolTip 提示;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
public static Admin adm;
public Form2()
{
//
// Windows 窗體設(shè)計(jì)器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form2));
this.txtName = new System.Windows.Forms.TextBox();
this.txtPassword = new System.Windows.Forms.TextBox();
this.提示 = new System.Windows.Forms.ToolTip(this.components);
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(432, 208);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(112, 21);
this.txtName.TabIndex = 0;
this.txtName.Text = "";
this.提示.SetToolTip(this.txtName, "請(qǐng)輸入登陸名");
this.txtName.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtName_KeyPress);
//
// txtPassword
//
this.txtPassword.Location = new System.Drawing.Point(432, 240);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(112, 21);
this.txtPassword.TabIndex = 1;
this.txtPassword.Text = "";
this.提示.SetToolTip(this.txtPassword, "請(qǐng)輸入密碼");
this.txtPassword.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtPassword_KeyPress);
//
// pictureBox1
//
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(496, 280);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(56, 26);
this.pictureBox1.TabIndex = 4;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
this.pictureBox1.MouseEnter += new System.EventHandler(this.pictureBox1_MouseEnter);
this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
//
// pictureBox2
//
this.pictureBox2.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
this.pictureBox2.Location = new System.Drawing.Point(432, 280);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(54, 23);
this.pictureBox2.TabIndex = 5;
this.pictureBox2.TabStop = false;
this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
this.pictureBox2.MouseEnter += new System.EventHandler(this.pictureBox2_MouseEnter);
this.pictureBox2.MouseLeave += new System.EventHandler(this.pictureBox2_MouseLeave);
//
// Form2
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(600, 397);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.txtName);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form2";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "湖北省就業(yè)指導(dǎo)中心";
this.Closing += new System.ComponentModel.CancelEventHandler(this.Form2_Closing);
this.SizeChanged += new System.EventHandler(this.Form2_SizeChanged);
this.Load += new System.EventHandler(this.Form2_Load);
this.Enter += new System.EventHandler(this.Form2_Enter);
this.ResumeLayout(false);
}
#endregion
private void Form2_Load(object sender, System.EventArgs e)
{
}
private void Form2_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if( this.DialogResult == DialogResult.OK )
{
}
else
{
this.DialogResult = DialogResult.Cancel;
}
}
private void Form2_SizeChanged(object sender, System.EventArgs e)
{
}
private void Form2_Enter(object sender, System.EventArgs e)
{
txtName.Text = txtName.Text.Trim();
txtPassword.Text = txtPassword.Text.Trim();
adm = new Admin( txtName.Text,txtPassword.Text );
if(adm.IsExist( ))
{
this.DialogResult = DialogResult.OK;
}
else
{
MessageBox.Show("用戶名不存在或密碼不正確!","登陸提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Information );
}
}
private void pictureBox1_MouseEnter(object sender, System.EventArgs e)
{
pictureBox1.Image = Image.FromFile( "img\\button-登錄02.GIF");
}
private void pictureBox1_MouseLeave(object sender, System.EventArgs e)
{
pictureBox1.Image = Image.FromFile( "img\\button-登錄01.GIF");
}
private void pictureBox2_MouseEnter(object sender, System.EventArgs e)
{
pictureBox2.Image = Image.FromFile( "img\\button-注冊(cè)02.GIF");
}
private void pictureBox2_MouseLeave(object sender, System.EventArgs e)
{
pictureBox2.Image = Image.FromFile( "img\\button-注冊(cè)01.GIF");
}
private void pictureBox1_Click(object sender, System.EventArgs e)
{
txtName.Text = txtName.Text.Trim();
txtPassword.Text = txtPassword.Text.Trim();
adm = new Admin( txtName.Text,txtPassword.Text );
if(adm.IsExist( ))
{
this.DialogResult = DialogResult.OK;
}
else
{
MessageBox.Show("用戶名不存在或密碼不正確!","登陸提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Information );
}
}
private void pictureBox2_Click(object sender, System.EventArgs e)
{
Register frmReg = new Register();
frmReg.ShowDialog();
}
private void txtPassword_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if ( e.KeyChar == 13 )
{
pictureBox1_Click( sender, e );
}
}
private void txtName_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if ( e.KeyChar == 13 )
{
pictureBox1_Click( sender, e );
}
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -