-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathComboBox.cs
More file actions
37 lines (31 loc) · 1.35 KB
/
ComboBox.cs
File metadata and controls
37 lines (31 loc) · 1.35 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
using System;
using System.Windows.Forms;
namespace Examples {
class Form1 : Form {
// The main entry point for the application.
public static void Main() {
Application.EnableVisualStyles();
Application.Run(new Form1());
}
public Form1() {
comboBox1.Location = new System.Drawing.Point(10, 10);
comboBox1.Items.AddRange(new string[] { "item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8", "item9", "item10" });
comboBox1.SelectedIndex = 0;
comboBox1.Parent = this;
comboBox2.Location = new System.Drawing.Point(10, 50);
comboBox2.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox2.Items.AddRange(new string[] { "item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8", "item9", "item10" });
comboBox2.SelectedIndex = 1;
comboBox2.Parent = this;
comboBox3.Location = new System.Drawing.Point(10, 90);
comboBox3.DropDownStyle = ComboBoxStyle.Simple;
comboBox3.Items.AddRange(new string[] { "item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8", "item9", "item10" });
comboBox3.SelectedIndex = 2;
comboBox3.Parent = this;
Text = "ComboBox example";
}
private ComboBox comboBox1 = new ComboBox();
private ComboBox comboBox2 = new ComboBox();
private ComboBox comboBox3 = new ComboBox();
};
}