login.cs
2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HcgClientExport
{
public partial class login : Form
{
public login()
{
InitializeComponent();
this.textBox1.GotFocus += new EventHandler(textBox1_GotFocus);
this.textBox2.GotFocus += new EventHandler(textBox2_GotFocus);
textBox1.MouseUp += new MouseEventHandler(textBox1_MouseUp);
textBox2.MouseUp += new MouseEventHandler(textBox2_MouseUp);
this.FormBorderStyle = FormBorderStyle.FixedSingle;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.Icon=((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
}
// private string titie = "xhcx";
private void button1_Click(object sender, EventArgs e)
{
Form1 f = new Form1();
string ss = new DataControl().GetLogin(this.textBox1.Text, En.GenerateMD5(this.textBox2.Text),f );
if (ss.Equals("1"))
{
this.Hide();
f.uid = this.textBox1.Text;
f.ShowDialog();
Application.Exit();
}
else if (ss.Equals("-1"))
{
MessageBox.Show("登陆失败");
}
else
{
MessageBox.Show(ss);
}
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void textBox1_Click(object sender, EventArgs e)
{
// this.textBox1.
}
void textBox1_MouseUp(object sender, MouseEventArgs e)
{
//如果鼠标左键操作并且标记存在,则执行全选
if (e.Button == MouseButtons.Left && (bool)textBox1.Tag == true)
{
textBox1.SelectAll();
}
//取消全选标记
textBox1.Tag = false;
}
void textBox2_MouseUp(object sender, MouseEventArgs e)
{
//如果鼠标左键操作并且标记存在,则执行全选
if (e.Button == MouseButtons.Left && (bool)textBox2.Tag == true)
{
textBox2.SelectAll();
}
//取消全选标记
textBox2.Tag = false;
}
void textBox2_GotFocus(object sender, EventArgs e)
{
textBox2.Tag = true; //设置标记
textBox2.SelectAll(); //注意1
}
void textBox1_GotFocus(object sender, EventArgs e)
{
textBox1.Tag = true; //设置标记
textBox1.SelectAll(); //注意1
}
}
}