?? ve-c1.tmp
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
//createprocess
//using System.Runtime.InteropServices;
//using System.Reflection;
namespace PDA_test
{
/// <summary>
/// Login 的摘要說明。
/// </summary>
public class Login : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox name;
private System.Windows.Forms.TextBox password;
//internal static Login LoginForm;
//用戶身份驗證。
// private String nameCheck;
//private String psaaCheck;
private int textFocus;
private System.Windows.Forms.Button login_b;
private System.Windows.Forms.Button n1;
private System.Windows.Forms.Button n2;
private System.Windows.Forms.Button n3;
private System.Windows.Forms.Button n6;
private System.Windows.Forms.Button n5;
private System.Windows.Forms.Button n4;
private System.Windows.Forms.Button n9;
private System.Windows.Forms.Button n8;
private System.Windows.Forms.Button n7;
private System.Windows.Forms.Button nBackSpace;
private System.Windows.Forms.Button n0;
private System.Windows.Forms.Button nClear;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label2;
private System.Data.SqlClient.SqlConnection sql_conn;
private System.Data.SqlClient.SqlDataAdapter sql_da;
private System.Data.SqlClient.SqlCommandBuilder sql_cb;
private System.Data.SqlClient.SqlCommand sql_cmd;
private System.Data.DataTable data_uid;
private PDA_test.ReaderForm frm_start;
private string czy_id;
private string czy_name;
private System.Windows.Forms.Button button2;
private string connSql;
#if COMPLETE_FRAMEWORK
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#endif
public Login()
{
//
// Windows 窗體設計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調用后添加任何構造函數代碼
//
}
static void Main()
{
Application.Run(new Login());
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows 窗體設計器生成的代碼
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Login));
this.login_b = new System.Windows.Forms.Button();
this.name = new System.Windows.Forms.TextBox();
this.password = new System.Windows.Forms.TextBox();
this.n1 = new System.Windows.Forms.Button();
this.n2 = new System.Windows.Forms.Button();
this.n3 = new System.Windows.Forms.Button();
this.n6 = new System.Windows.Forms.Button();
this.n5 = new System.Windows.Forms.Button();
this.n4 = new System.Windows.Forms.Button();
this.n9 = new System.Windows.Forms.Button();
this.n8 = new System.Windows.Forms.Button();
this.n7 = new System.Windows.Forms.Button();
this.nBackSpace = new System.Windows.Forms.Button();
this.n0 = new System.Windows.Forms.Button();
this.nClear = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
//
// login_b
//
this.login_b.Font = new System.Drawing.Font("楷體_GB2312", 18F, System.Drawing.FontStyle.Bold);
this.login_b.Location = new System.Drawing.Point(8, 224);
this.login_b.Size = new System.Drawing.Size(144, 40);
this.login_b.Text = "登 錄";
this.login_b.Click += new System.EventHandler(this.button1_Click);
//
// name
//
this.name.BackColor = System.Drawing.SystemColors.Window;
this.name.Location = new System.Drawing.Point(8, 128);
this.name.Size = new System.Drawing.Size(96, 21);
this.name.Text = "textBox1";
this.name.GotFocus += new System.EventHandler(this.name_GotFocus);
this.name.TextChanged += new System.EventHandler(this.name_TextChanged);
//
// password
//
this.password.Location = new System.Drawing.Point(8, 184);
this.password.PasswordChar = '*';
this.password.Size = new System.Drawing.Size(96, 21);
this.password.Text = "textBox2";
this.password.GotFocus += new System.EventHandler(this.password_GotFocus);
//
// n1
//
this.n1.Font = new System.Drawing.Font("楷體_GB2312", 14.25F, System.Drawing.FontStyle.Bold);
this.n1.Location = new System.Drawing.Point(112, 88);
this.n1.Size = new System.Drawing.Size(40, 32);
this.n1.Text = "1";
this.n1.Click += new System.EventHandler(this.n1_Click);
//
// n2
//
this.n2.Font = new System.Drawing.Font("楷體_GB2312", 14.25F, System.Drawing.FontStyle.Bold);
this.n2.Location = new System.Drawing.Point(152, 88);
this.n2.Size = new System.Drawing.Size(40, 32);
this.n2.Text = "2";
this.n2.Click += new System.EventHandler(this.n2_Click);
//
// n3
//
this.n3.Font = new System.Drawing.Font("楷體_GB2312", 14.25F, System.Drawing.FontStyle.Bold);
this.n3.Location = new System.Drawing.Point(192, 88);
this.n3.Size = new System.Drawing.Size(40, 32);
this.n3.Text = "3";
this.n3.Click += new System.EventHandler(this.n3_Click);
//
// n6
//
this.n6.Font = new System.Drawing.Font("楷體_GB2312", 14.25F, System.Drawing.FontStyle.Bold);
this.n6.Location = new System.Drawing.Point(192, 120);
this.n6.Size = new System.Drawing.Size(40, 32);
this.n6.Text = "6";
this.n6.Click += new System.EventHandler(this.n6_Click);
//
// n5
//
this.n5.Font = new System.Drawing.Font("楷體_GB2312", 14.25F, System.Drawing.FontStyle.Bold);
this.n5.Location = new System.Drawing.Point(152, 120);
this.n5.Size = new System.Drawing.Size(40, 32);
this.n5.Text = "5";
this.n5.Click += new System.EventHandler(this.n5_Click);
//
// n4
//
this.n4.Font = new System.Drawing.Font("楷體_GB2312", 14.25F, System.Drawing.FontStyle.Bold);
this.n4.Location = new System.Drawing.Point(112, 120);
this.n4.Size = new System.Drawing.Size(40, 32);
this.n4.Text = "4";
this.n4.Click += new System.EventHandler(this.n4_Click);
//
// n9
//
this.n9.Font = new System.Drawing.Font("楷體_GB2312", 14.25F, System.Drawing.FontStyle.Bold);
this.n9.Location = new System.Drawing.Point(192, 152);
this.n9.Size = new System.Drawing.Size(40, 32);
this.n9.Text = "9";
this.n9.Click += new System.EventHandler(this.n9_Click);
//
// n8
//
this.n8.Font = new System.Drawing.Font("楷體_GB2312", 14.25F, System.Drawing.FontStyle.Bold);
this.n8.Location = new System.Drawing.Point(152, 152);
this.n8.Size = new System.Drawing.Size(40, 32);
this.n8.Text = "8";
this.n8.Click += new System.EventHandler(this.n8_Click);
//
// n7
//
this.n7.Font = new System.Drawing.Font("楷體_GB2312", 14.25F, System.Drawing.FontStyle.Bold);
this.n7.Location = new System.Drawing.Point(112, 152);
this.n7.Size = new System.Drawing.Size(40, 32);
this.n7.Text = "7";
this.n7.Click += new System.EventHandler(this.n7_Click);
//
// nBackSpace
//
this.nBackSpace.Font = new System.Drawing.Font("楷體_GB2312", 9F, System.Drawing.FontStyle.Bold);
this.nBackSpace.Location = new System.Drawing.Point(192, 184);
this.nBackSpace.Size = new System.Drawing.Size(40, 32);
this.nBackSpace.Text = "退格";
this.nBackSpace.Click += new System.EventHandler(this.nBackSpace_Click);
//
// n0
//
this.n0.Font = new System.Drawing.Font("楷體_GB2312", 14.25F, System.Drawing.FontStyle.Bold);
this.n0.Location = new System.Drawing.Point(152, 184);
this.n0.Size = new System.Drawing.Size(40, 32);
this.n0.Text = "0";
this.n0.Click += new System.EventHandler(this.n0_Click);
//
// nClear
//
this.nClear.Font = new System.Drawing.Font("楷體_GB2312", 9F, System.Drawing.FontStyle.Bold);
this.nClear.Location = new System.Drawing.Point(112, 184);
this.nClear.Size = new System.Drawing.Size(40, 32);
this.nClear.Text = "清除";
this.nClear.Click += new System.EventHandler(this.nClear_Click);
//
// label1
//
this.label1.Font = new System.Drawing.Font("楷體_GB2312", 12F, System.Drawing.FontStyle.Bold);
this.label1.ForeColor = System.Drawing.Color.Blue;
this.label1.Location = new System.Drawing.Point(8, 104);
this.label1.Size = new System.Drawing.Size(72, 24);
this.label1.Text = "工號:";
//
// label2
//
this.label2.Font = new System.Drawing.Font("楷體_GB2312", 12F, System.Drawing.FontStyle.Bold);
this.label2.ForeColor = System.Drawing.Color.Blue;
this.label2.Location = new System.Drawing.Point(8, 160);
this.label2.Size = new System.Drawing.Size(72, 24);
this.label2.Text = "密碼:";
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Size = new System.Drawing.Size(240, 280);
this.pictureBox1.ParentChanged += new System.EventHandler(this.pictureBox1_ParentChanged);
//
// button1
//
this.button1.Font = new System.Drawing.Font("楷體_GB2312", 18F, System.Drawing.FontStyle.Bold);
this.button1.Location = new System.Drawing.Point(160, 224);
this.button1.Size = new System.Drawing.Size(72, 40);
this.button1.Text = "退出";
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// button2
//
this.button2.Location = new System.Drawing.Point(152, 8);
this.button2.Size = new System.Drawing.Size(80, 24);
this.button2.Text = "button2";
this.button2.Visible = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Login
//
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.nBackSpace);
this.Controls.Add(this.n0);
this.Controls.Add(this.nClear);
this.Controls.Add(this.n9);
this.Controls.Add(this.n8);
this.Controls.Add(this.n7);
this.Controls.Add(this.n6);
this.Controls.Add(this.n5);
this.Controls.Add(this.n4);
this.Controls.Add(this.n3);
this.Controls.Add(this.n2);
this.Controls.Add(this.n1);
this.Controls.Add(this.password);
this.Controls.Add(this.name);
this.Controls.Add(this.login_b);
this.Controls.Add(this.pictureBox1);
this.Text = "登錄";
this.Load += new System.EventHandler(this.Login_Load);
}
#endregion
private void Login_Load(object sender, System.EventArgs e)
{
name.Text="";
password.Text="";
name.Focus();
textFocus=1; //焦點為name
if(Symbol.Win32.PlatformType == "PocketPC")
{
this.Menu = new MainMenu();
}
//fghisdb503
//connSql="data source=172.16.10.11,1433;user id=fugle;initial catalog=FGYPDB;password=fghisdb503";
try
{
//sql_conn = new SqlConnection( connSql );
}
catch (SqlException ex)
{
//MessageBox.Show( "Error connecting to the server: " + ex.Message );
//MessageBox.Show("網絡故障,連接中斷,請重起程序。");
//MessageBox.Show(this.connSql.ToString());
}
}
private void button1_Click(object sender, System.EventArgs e)
{
//
//此處添加數據庫聯接與權限判斷模塊
//
// if (ReaderForm.frm1==null)
// {
// ReaderForm.frm1=new ReaderForm();
// }
// LoginForm=this;
// ReaderForm.frm1.Show();
// ReaderForm.frm1.gonghao.Text=name.Text;
// LoginForm.Hide();
string log_name=this.name.Text.ToString().Trim();
string log_pwd=this.password.Text.ToString().Trim();
czy_id="wrong";
this.pwd_confirm(log_name,log_pwd);
if (czy_id=="wrong")
{
}
else
{
this.frm_start=new ReaderForm(this);
this.frm_start.gonghao.Text=czy_id.ToString();
this.frm_start.label_name.Text=this.czy_name.ToString();
this.frm_start.log_name=czy_id.ToString().Trim();
this.frm_start.Sql_string=connSql.ToString();
password.Text="";
this.frm_start.Show();
this.Hide();
}
}
private void pwd_confirm(string in_name ,string pwd_in)
{
//data_uid=new System.Data.DataTable();
try
{
this.czy_id=" ";
//sql_cmd=new SqlCommand();
//sql_cmd.Connection=sql_conn;
//string lc_sql_cmd="exec get_uid '"+in_name.ToString().Trim()+"'";
//sql_conn.Open();
//sql_da =new SqlDataAdapter(lc_sql_cmd, sql_conn );
//sql_cb =new SqlCommandBuilder( sql_da );
//sql_da.Fill(data_uid);
//sql_conn.Close();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -