Tree views display nodes in a hierarchical structure, and each node in a tree view is a TreeNode object. Here is the class hierarchy of the TreeNode class:
Object MarshalByRefObject TreeNode
You can find the notable public properties of TreeNode objects in Table 10.6 and the notable public methods in Table 10.7.
Property |
Means |
---|---|
Bounds |
Gets the actual bounds of the tree node. |
Checked |
Gets/sets whether the tree node is checked. |
FirstNode |
Gets the first child tree node. |
FullPath |
Gets the path from the root node to the current node. |
ImageIndex |
Gets/sets the image list index of the image displayed for a node. |
Index |
Gets the location of the node in the node collection. |
IsEditing |
Gets whether the node can be edited. |
IsExpanded |
Gets whether the node is expanded. |
IsSelected |
Gets whether the node is selected. |
IsVisible |
Gets a value specifying if the node is visible. |
LastNode |
Gets the last child node. |
NextNode |
Gets the next sibling node. |
NextVisibleNode |
Gets the next visible node. |
NodeFont |
Gets/sets the font for the node. |
Nodes |
Gets the collection of nodes in the current node. |
Parent |
Gets the parent node of the current node. |
PrevNode |
Gets the previous sibling node. |
PrevVisibleNode |
Gets the previous visible node. |
SelectedImageIndex |
Gets/sets the image index for the image to display when a node is selected. |
Text |
Gets/sets the text for a node's label. |
TreeView |
Gets the node's parent tree view. |
Method |
Means |
---|---|
BeginEdit |
Starts editing of the node's label. |
Collapse |
Collapses a node. |
EndEdit |
Ends editing of the node's label. |
EnsureVisible |
Makes sure the node is visible, scrolling the tree view if needed. |
Expand |
Expands a node. |
ExpandAll |
Expands all child nodes. |
GetNodeCount |
Gets the number of child nodes. |
Remove |
Removes the current node. |
Toggle |
Toggles the tree node between the expanded and collapsed states. |