purecomponents-header3

TreeView Control

TreeView is based on object model of standard TreeView component. It's extended by many useful functions which make it an excellent component for presenting information in hierarchy. With help of in-place designer you can create a tree of information without writing any line of code. In run-time it is possible to edit each node of hierarchy and change their position by drag and drop. You can highlight certain kind of information by several different ways. You can do it by flags, underline or Flash function. Each node can also have its own image.

TreeView20

Appearance of TreeView is being set by property TreeView.Style. You can find here BorderStyle which defines how the TreeView border is painted. Following picture shows three of five possibilities.

You can set background fill of TreeView  with FillStyle property. Following picture shows three of five possibilities.

There is the possibility to set the style of lines using LineStyle and LineColor and also the back color can be altered using BackColor property. FlashColor property specifies color of lines when they are being flashed using the Flash function. TreeView allows you to indicate also with another way that a node has sub-nodes if you set property ShowSubItemsIndicator to True a little triangle will be shown next to node text.

       

Node Appearance

Node can have for every of its three states different colors, appearance is being influenced by its NodeStyle property. Basic colors are ForeColor and BackColor, colors in HoverForeColor and HoverBackColor defines how a Node is painted when mouse is over the node and SelectedForeColor, SelectedBackColor and SelectedBorderColor, are colors defining the appearance when Node is selected, Node can be Underlined. Style and color of underline can be altered using UnderlineStyle and UnderlineColor properties.

ExpandBoxes Appearance

TreeView component allow set style and colors of an expand boxes by ExpandBoxStyle. You can set ForeColor, BackColor and style of the expand box by Shape property.

CheckBoxes Appearance

Every node can have its own checkbox. TreeView.Checkboxes property will switch on the checkboxes. Checkbox visibility is independent for every node, you can set it by Node.CheckBoxVisible property. You can specify that checkboxes are visible for only some specific nodes, state of checkbox can be retrieved or altered by Node.Checked property.

Checkboxes have a rich possibilities of styling by CheckBoxStyle. You can set BorderColor and BackColor of the box and CheckColor of the check sign. Mouse hover can be highlighting by HoverBorderColor, HoverBackColor and HoverCheckColor. You can choose one from four border styles of the checkbox by BorderStyle property.


NodeTooltip Appearance

Each Node of TreeView component can have a tooltip. You can set style of tooltip by NodeTooltipStyle class. Tooltip can be colorized by BorderColor, BackColor and ForeColor properties.

Node ContextMenu

To assign ContextMenu to Node use Node.ContextMenu property. Node.ContextMenuSource specifies the source of ContextMenu . Local defines that Node's own ContextMenu will be used. Interesting value is Parent, this value can be used in more complex hierarchies where ContextMenu is assigned to high level node and all subnodes have ContextMenuSource set to Parent all nodes then will use one ContextMenu.

TreeView_BuiltinMenu

Built-in ContextMenu functions

You can activate a special editing and arranging functions in TreeView's context menu by ContextMenuEditing, ContextMenuArranging and ContextMenuXmlOperations properties. Set these properties to True and see the context menu in run-time. The ContextMenuEditing property adds to context menu commands for node editing, the ContextMenuArranging adds commands for arranging nodes and the ContextMenuXmlOperations adds commands for saving and loading TreeView content.