-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTreeView.cs
More file actions
34 lines (30 loc) · 1.07 KB
/
TreeView.cs
File metadata and controls
34 lines (30 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
32
33
34
using System;
using System.Windows.Forms;
namespace Examples {
class MainForm : Form {
public static void Main() {
Application.EnableVisualStyles();
Application.Run(new MainForm());
}
public MainForm() {
Text = "TreeView example";
ClientSize = new System.Drawing.Size(300, 300);
treeView.Parent = this;
treeView.Location = new System.Drawing.Point(10, 10);
treeView.Size = new System.Drawing.Size(150, 200);
treeView.CheckBoxes = true;
treeView.Nodes.Add("Root");
treeView.Nodes[0].Nodes.Add("First");
treeView.Nodes[0].Nodes[0].Nodes.Add("Second");
treeView.Nodes[0].Nodes[0].Nodes[0].Checked = true;
treeView.Nodes[0].Nodes[0].Nodes.Add("Third");
treeView.Nodes[0].Nodes.Add("Fourth");
treeView.Nodes[0].Nodes[1].Nodes.Add("Fifth");
treeView.Nodes[0].Nodes[1].Nodes.Add("Sixth");
treeView.Nodes[0].Nodes[1].Nodes[1].Checked = true;
treeView.Nodes[0].Nodes[1].Nodes.Add("Seventh");
treeView.ExpandAll();
}
private TreeView treeView = new TreeView();
}
}