Visual design tools such as Visual Studio 2005 often include utilities for generating the line images automatically.
#Excel treeview generator#
You can edit the appearance of these line images using the Line Image Generator on the TreeView control's shortcut menu, or you can assign custom images to each of these line features yourself. The control renders these lines when the ShowLines property is set to true.
#Excel treeview series#
The TreeView control can render lines that connect tree nodes with a series of prerendered images. Note that when rendered, the tree node "" would have a star (Star.gif) as the node image instead of the image assigned using the LeafNodeStyle property.
#Excel treeview how to#
The following example shows how to override the specified node-style image for a single tree node. The following example shows how to assign properties. Each TreeNode type can selectively override the default image for its node type using the ImageUrl property. These images are rendered to the left of the node text. Each property can be used to define an ImageUrl value for a property applied to that node type. These are the RootNodeStyle, ParentNodeStyle, and LeafNodeStyle properties, respectively. The TreeView control exposes property styles for the three TreeNode types: root, parent, and leaf nodes.
A leaf node is any node in the TreeView control's node collection that has no child nodes it is neither a root node nor a parent node. A parent node is any node in the TreeView control's node collection that has child nodes underneath it in the hierarchy. A root node is any node that has child nodes and has its Parent property set to null it is the top-level node in the tree. Using Custom Images for Root, Parent, and Leaf NodesĮach TreeView control can consist of root, parent, and leaf nodes. Note that you can turn off the rendering of the expand and collapse images by setting the ShowExpandCollapse property to false. The following example sets these properties to custom images in the Images directory of the Web site. These properties include ExpandImageUrl, CollapseImageUrl, and NoExpandImageUrl.
To assign an image to a particular node type, you assign the location of the image file to be used to the corresponding property. You can create images for this purpose in most graphics programs. You can use images to indicate an expandable node, a collapsible node, or a node that does not expand or collapse. įor a complete list and description of the image sets available for the TreeView control, see the ImageSet property.
#Excel treeview code#
The following code example shows a TreeView control that uses the Windows XP file explorer image set. The sets also include several bulleted list styles.
The image set that is built into the TreeView control includes sets of image resources common in trees used with MSN Messenger, Microsoft Outlook, Windows Explorer and Microsoft Windows Help. The easiest way to assign images to a TreeView control is by using the ImageSet property. If an image property is not explicitly set, the built-in default image is used. Note that you do not need to customize every image property. You can generate these lines using the Line Image Generator dialog box available on the TreeView control (when the Show Lines property is checked), or you can create the images yourself. In addition to these images, the TreeView control also uses images to create lines that connect TreeView items when the ShowLines property is set to true. The visual elements of a TreeView control include the following: You can also use a predefined set of images from the ImageSet property, or use custom images by setting the individual image properties. You can use images with the TreeView control to represent nodes, connecting lines, and the expand and collapse icons. The TreeView control is capable of many different appearances, providing flexible image customization as well as properties that specify custom user interface (UI) options.