-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathListBox.cs
More file actions
46 lines (39 loc) · 1.98 KB
/
ListBox.cs
File metadata and controls
46 lines (39 loc) · 1.98 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
using System;
using System.Windows.Forms;
namespace Examples {
class MainForm : Form {
public static void Main() {
Application.EnableVisualStyles();
Application.Run(new MainForm());
}
public MainForm() {
Text = "ListBox example";
StartPosition = FormStartPosition.Manual;
Location = new System.Drawing.Point(200, 200);
ClientSize = new System.Drawing.Size(360, 240);
listBoxActionsLeft.Parent = this;
listBoxActionsLeft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom;
listBoxActionsLeft.Bounds = new System.Drawing.Rectangle(20, 20, 150, 200);
listBoxActionsLeft.DoubleClick += delegate(object sender, EventArgs e) {
if (listBoxActionsLeft.SelectedIndex != -1) {
listBoxActionsRight.Items.Add(listBoxActionsLeft.SelectedItem);
listBoxActionsRight.SelectedIndex = listBoxActionsRight.Items.Count - 1;
listBoxActionsLeft.Items.Remove(listBoxActionsLeft.SelectedItem);
}
};
listBoxActionsRight.Parent = this;
listBoxActionsRight.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;
listBoxActionsRight.Bounds = new System.Drawing.Rectangle(190, 20, 150, 200);
listBoxActionsRight.DoubleClick += delegate(object sender, EventArgs e) {
if (listBoxActionsRight.SelectedIndex != -1) {
listBoxActionsLeft.Items.Add(listBoxActionsRight.SelectedItem);
listBoxActionsLeft.SelectedIndex = listBoxActionsLeft.Items.Count - 1;
listBoxActionsRight.Items.Remove(listBoxActionsRight.SelectedItem);
}
};
listBoxActionsLeft.Items.AddRange(new string[] { "draw", "cut", "paste", "delete", "open", "close", "remove", "edit", "find", "increment", "decrement", "write", "read", "post", "build", "make", "release", "create", "choose", "erase"});
}
private ListBox listBoxActionsLeft = new ListBox();
private ListBox listBoxActionsRight = new ListBox();
}
}