-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm1.cs
More file actions
125 lines (123 loc) · 4.04 KB
/
Form1.cs
File metadata and controls
125 lines (123 loc) · 4.04 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
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
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;
using Exps;
namespace Exps
{
public partial class Form1 : Form
{
int genTime;
int labelShowTime;
bool isShowClipChar;
private string FormName = "CharPanel";
Random random = new Random((int)DateTime.Now.Ticks);
public Form1()
{
InitializeComponent();
}
public int[] charDB = new int[16*7];
private string combinegens(string labelchar)
{
StringBuilder str = new StringBuilder();
char c = ' ';
for (int i = 0; i < genTime; i++)
{
c = Convert.ToChar(Convert.ToInt32(Math.Floor(112 * random.NextDouble() + 0x300)));
str.Append(c);
}
string actionchar = labelchar + str;
return Convert.ToString(actionchar);
}
private void button1_Click(object sender, EventArgs e)
{
genTime = Convert.ToInt32(numericUpDown1.Value);
watermarkTextBox1.Text = combinegens(watermarkTextBox1.Text);
}
public void initChars()
{
const int STARTX = 3;
const int STARTY = 3;
var x = 0;
var y = 0;
var time = 0;
for (int a = 0; a < 7; a++)
{
y = a * 29;
for (int b = 0; b < 16; b++)
{
x = b * 47;
time++;
Button button = new Button
{
Name = FormName + Convert.ToString(time),
Location = new Point(STARTX + x, STARTY + y),
Size = new Size(43, 23),
Tag = time + 0x2ff,
Text = " "+Convert.ToString(Convert.ToChar(time + 0x2ff))
};
button.MouseDown += new MouseEventHandler(qwq_Click);
panel1.Controls.Add(button);
panel1.Size = new Size(STARTX * 2 + x+47, STARTY * 2 + y+29);
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
this.Size = new Size(325, 153);
initChars();
}
private void qwq_Click(object sender, MouseEventArgs e)
{
Button btn = (Button)sender;
if (e.Button == MouseButtons.Left)
{
labelShowTime = 60;
Clipboard.SetText(Convert.ToString(Convert.ToChar(btn.Tag)));
}
else if (e.Button == MouseButtons.Right)
{
MessageBox.Show(" " + Convert.ToString(Convert.ToChar(btn.Tag)) + "\n" + "ID: " + Convert.ToString(btn.Tag) + "\n" + "Unicode ID: " + "0x" + Convert.ToInt32(btn.Tag).ToString("X"));
}
}
private void ClipboardChar(int a)
{
Clipboard.SetDataObject(Convert.ToString(a), true);
}
private void button2_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;
if (isShowClipChar == false)
{
btn.Text = "隐藏字符集";
isShowClipChar = true;
this.Size = new Size(787, 375 + 16);
watermarkTextBox1.Size = new Size(757, 23);
}
else
{
btn.Text = "显示字符集";
isShowClipChar = false;
this.Size = new Size(325, 153);
watermarkTextBox1.Size = new Size(297, 23);
}
panel1.Enabled = isShowClipChar;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (labelShowTime <= 0)
{
label5.Visible = false;
}
else
{
labelShowTime--;
label5.Visible = true;
}
}
}
}