-
Notifications
You must be signed in to change notification settings - Fork 0
/
ControlEvent.cs
169 lines (154 loc) · 5.08 KB
/
ControlEvent.cs
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace miniSys0._3
{
public class TextBoxCE
{
private UITextBox Source;
private string Text;
private Color RectColor = Color.White;
public TextBoxCE(UITextBox textBox,string textContent)
{
this.Source = textBox;
this.Text = textContent;
this.Source.Enter += new EventHandler(TextBoxEnter);
this.Source.Leave += new EventHandler(TextBoxLeave);
}
public TextBoxCE(UITextBox textBox, string textContent, Color RectColor)
{
this.Source = textBox;
this.Text = textContent;
this.RectColor = RectColor;
this.Source.Enter += new EventHandler(TextBoxEnter);
this.Source.Leave += new EventHandler(TextBoxLeave);
}
private void TextBoxEnter(object senter, EventArgs e)
{
this.Source.RectColor = this.RectColor;
this.Source.Font = new Font(".萍方-简", 12, FontStyle.Bold);
if (this.Source.Text == this.Text)
{
this.Source.Text = "";
}
}
private void TextBoxLeave(object senter, EventArgs e)
{
if (this.Source.Text == "")
{
this.Source.Text = this.Text;
this.Source.Font = new Font(".萍方-简", 12, FontStyle.Regular);
}
}
}
public class RichTextBoxCE
{
private UIRichTextBox Source;
private string Text;
private Color RectColor = Color.White;
public RichTextBoxCE(UIRichTextBox textBox, string textContent)
{
this.Source = textBox;
this.Text = textContent;
this.Source.Enter += new EventHandler(TextBoxEnter);
this.Source.Leave += new EventHandler(TextBoxLeave);
}
public RichTextBoxCE(UIRichTextBox textBox, string textContent, Color RectColor)
{
this.Source = textBox;
this.Text = textContent;
this.RectColor = RectColor;
this.Source.Enter += new EventHandler(TextBoxEnter);
this.Source.Leave += new EventHandler(TextBoxLeave);
}
private void TextBoxEnter(object senter, EventArgs e)
{
this.Source.RectColor = this.RectColor;
this.Source.Font = new Font(".萍方-简", 12, FontStyle.Bold);
if (this.Source.Text == this.Text)
{
this.Source.Text = "";
}
}
private void TextBoxLeave(object senter, EventArgs e)
{
if (this.Source.Text == "")
{
this.Source.Text = this.Text;
this.Source.Font = new Font(".萍方-简", 12, FontStyle.Regular);
}
}
}
public class ComboBoxCE
{
private UIComboBox ComboBox;
private Color RectColor = Color.White;
public ComboBoxCE(UIComboBox comboBox,Color RectColor)
{
this.ComboBox = comboBox;
this.RectColor = RectColor;
this.ComboBox.DropDown += new EventHandler(ComboBox_DropDown);
this.ComboBox.DropDownClosed += new EventHandler(ComboBox_DropDownClosed);
}
private void ComboBox_DropDown(object senter, EventArgs e)
{
this.ComboBox.RectColor = this.RectColor;
this.ComboBox.RectSize = 1;
this.ComboBox.Font = new Font(".萍方-简", 12, FontStyle.Regular);
}
private void ComboBox_DropDownClosed(object senter, EventArgs e)
{
if (this.ComboBox.SelectedIndex == -1)
{
ComboBox.RectSize = 2;
ComboBox.RectColor = Color.Red;
}
else
{
this.ComboBox.Font = new Font(".萍方-简", 12, FontStyle.Bold);
}
}
}
public static class AddUserControl
{
public static void Add(dynamic control, Panel panel)
{
control.Dock = DockStyle.Fill;
panel.Controls.Clear();
panel.Controls.Add(control);
control.BringToFront();
}
}
public class PasswordBoxCE
{
private UITextBox Source;
private string Text;
public PasswordBoxCE(UITextBox textBox, string textContent)
{
this.Source = textBox;
this.Text = textContent;
}
private void PasswordBoxEnter()
{
this.Source.RectColor = Color.White;
if (this.Source.Text == this.Text)
{
this.Source.Text = "";
this.Source.PasswordChar = '*';
}
}
private void PasswordBoxLeave()
{
if (this.Source.Text == "")
{
this.Source.Text = this.Text;
this.Source.PasswordChar = '\0';
}
}
}
}