-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCheckedListBox.cs
More file actions
31 lines (25 loc) · 1.07 KB
/
CheckedListBox.cs
File metadata and controls
31 lines (25 loc) · 1.07 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
using System;
using System.Windows.Forms;
namespace Examples {
class MainForm : Form {
public static void Main() {
Application.EnableVisualStyles();
Application.Run(new MainForm());
}
public MainForm() {
Text = "CheckedListBox example";
StartPosition = FormStartPosition.Manual;
Location = new System.Drawing.Point(200, 200);
ClientSize = new System.Drawing.Size(200, 240);
checkedlistBox.Parent = this;
checkedlistBox.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
checkedlistBox.Bounds = new System.Drawing.Rectangle(20, 20, 160, 200);
for (int i = 1; i <= 10; ++i)
checkedlistBox.Items.Add(string.Format("Item {0}", i), i % 2 != 0);
checkedlistBox.ItemCheck += delegate (object sender, ItemCheckEventArgs e) {
System.Diagnostics.Debug.WriteLine(string.Format("item check, Index ={0}, NewValue={1}, CurrentValue={2}", e.Index, e.NewValue, e.CurrentValue));
};
}
private CheckedListBox checkedlistBox = new CheckedListBox();
}
}