JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the TreeView Class

As discussed in the In Depth section of this chapter+, tree view controls are designed to display a hierarchy of nodes, much like the left pane in the Windows Explorer. Here is the class hierarchy of the TreeView class:

Object
   MarshalByRefObject
      Component
         Control
            TreeView

You can find the notable public properties of TreeView objects in Table 10.3, the notable public methods in Table 10.4, and the notable public events in Table 10.5. Note that I'm omitting those properties, methods, and events TreeView objects inherit from the Control class—you'll find all that in Chapter 5, Tables 5.1, 5.2, and 5.3.

Table 10.3: Noteworthy public properties of TreeView objects.

Property

Means

BorderStyle

Gets/sets the tree view's border style.

CheckBoxes

Gets/sets whether checkboxes should be displayed next to tree nodes.

FullRowSelect

Gets/sets whether a selection should select the whole width of the tree view.

HideSelection

Gets/sets whether the selected tree node stays highlighted when the tree view loses the focus.

HotTracking

Gets/sets whether a tree node label should change its appearance when the mouse pointer moves over it.

ImageIndex

Gets/sets the image list index of the current image.

ImageList

Gets/sets the image list used with this tree view.

Indent

Gets/sets the distance that each level should be indented.

ItemHeight

Gets/sets the height of tree nodes.

LabelEdit

Gets/sets whether tree node text can be edited.

Nodes

Gets the collection of tree nodes.

PathSeparator

Gets/sets the string the tree node uses as a path delimiter.

Scrollable

Gets/sets whether the tree view should display scroll bars as needed.

SelectedImageIndex

Gets/sets the image index for the image to display when a node is selected.

SelectedNode

Gets/sets the node that is selected.

ShowLines

Gets/sets whether lines are drawn between tree nodes.

ShowPlusMinus

Gets/sets whether plus-sign (+) and minus-sign (-) buttons are shown next to tree nodes with child tree nodes.

ShowRootLines

Gets/sets whether lines should be drawn between the tree nodes and the root node.

Sorted

Gets/sets if the tree nodes should be sorted.

TopNode

Gets the first visible tree node.

VisibleCount

Gets the number of nodes that can be seen currently.

Table 10.4: Noteworthy public methods of TreeView objects.

Method

Means

BeginUpdate

Disables redrawing of the tree view.

CollapseAll

Collapses all nodes.

EndUpdate

Enables redrawing of the tree view.

ExpandAll

Expands all the nodes.

GetNodeAt

Gets the node that is at the given location.

GetNodeCount

Gets the number of nodes.

Table 10.5: Noteworthy public events of TreeView objects.

Event

Means

AfterCheck

Occurs when a node checkbox is checked.

AfterCollapse

Occurs when a tree node is collapsed.

AfterExpand

Occurs when a tree node is expanded.

AfterLabelEdit

Occurs when a tree node label text is edited.

AfterSelect

Occurs when a tree node is selected.

BeforeCheck

Occurs before a node checkbox is checked.

BeforeCollapse

Occurs before a node is collapsed.

BeforeExpand

Occurs before a node is expanded.

BeforeLabelEdit

Occurs before a node label text is edited.

BeforeSelect

Occurs before a node is selected.

ItemDrag

Occurs when an item is dragged into the tree view.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor