Share via


TreeView Control Overview (Windows Forms)

With the Windows Forms TreeView control, you can display a hierarchy of nodes to users, like the way files and folders are displayed in the left pane of the Windows Explorer feature of the Windows operating system. Each node in the tree view might contain other nodes, called child nodes. You can display parent nodes, or nodes that contain child nodes, as expanded or collapsed. You can also display a tree view with check boxes next to the nodes by setting the tree view's CheckBoxes property to true. You can then programmatically select or clear nodes by setting the node's Checked property to true or false.

Key Properties

The key properties of the TreeView control are Nodes and SelectedNode. The Nodes property contains the list of top-level nodes in the tree view. The SelectedNode property sets the currently selected node. You can display icons next to the nodes. The control uses images from the ImageList named in the tree view's ImageList property. The ImageIndex property sets the default image for nodes in the tree view. For more information about displaying images, see How to: Set Icons for the Windows Forms TreeView Control. If you are using Visual Studio 2005, you have access to a large library of standard images that you can use with the TreeView control. Visual Studio 2005 Image Library
Visual Studio Image Library

See Also

Tasks

How to: Set Icons for the Windows Forms TreeView Control
How to: Add and Remove Nodes with the Windows Forms TreeView Control
How to: Iterate Through All Nodes of a Windows Forms TreeView Control
How to: Determine Which TreeView Node Was Clicked (Windows Forms)
How to: Add Custom Information to a TreeView or ListView Control (Windows Forms)

Reference

TreeView

Other Resources

TreeView Control (Windows Forms)