-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCheckBox.cs
More file actions
61 lines (53 loc) · 2.22 KB
/
CheckBox.cs
File metadata and controls
61 lines (53 loc) · 2.22 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
using System;
using System.Windows.Forms;
namespace Examples {
class Form1 : Form {
public static void Main() {
Application.EnableVisualStyles();
Application.Run(new Form1());
}
public Form1() {
Text = "CheckBox example";
Controls.AddRange(new Control[] {checkBox1, checkBox2, checkBox3, checkBox4, checkBox5});
checkBox1.AutoCheck = false;
checkBox1.Click += delegate {
//checkBox1.Checked = !checkBox1.Checked;
//checkBox1.Text = string.Format("{0}", checkBox1.CheckState);
};
checkBox1.Location = new System.Drawing.Point(30, 30);
checkBox1.Text = string.Format("{0}", checkBox1.CheckState);
checkBox2.CheckedChanged += delegate (object sender, EventArgs e) {
checkBox2.Text = string.Format("{0}", checkBox2.CheckState);
};
checkBox2.Checked = true;
checkBox2.Location = new System.Drawing.Point(30, 60);
checkBox2.Checked = true;
checkBox3.CheckStateChanged += delegate (object sender, EventArgs e) {
checkBox3.Text = string.Format("{0}", checkBox3.CheckState);
};
checkBox3.CheckState = CheckState.Indeterminate;
checkBox3.Location = new System.Drawing.Point(30, 90);
checkBox3.Text = string.Format("{0}", checkBox3.CheckState);
checkBox3.ThreeState = true;
checkBox4.AutoCheck = false;
checkBox4.Appearance = Appearance.Button;
checkBox4.Click += delegate {
//checkBox4.Checked = !checkBox4.Checked;
//checkBox4.Text = string.Format("{0}", checkBox4.CheckState);
};
checkBox4.Location = new System.Drawing.Point(30, 120);
checkBox4.Text = string.Format("{0}", checkBox4.CheckState);
checkBox5.Appearance = Appearance.Button;
checkBox5.CheckStateChanged += delegate (object sender, EventArgs e) {
checkBox5.Text = string.Format("{0}", checkBox5.CheckState);
};
checkBox5.Checked = true;
checkBox5.Location = new System.Drawing.Point(30, 150);
}
private CheckBox checkBox1 = new CheckBox();
private CheckBox checkBox2 = new CheckBox();
private CheckBox checkBox3 = new CheckBox();
private CheckBox checkBox4 = new CheckBox();
private CheckBox checkBox5 = new CheckBox();
};
}