需要了解的属性:
AbsoluteIndex | property AbsoluteIndex: Integer;
Use AbsoluteIndex to determine absolute position of a node in a tree nodes object. The first tree node in a tree nodes object has an index of 0 and subsequent nodes are numbered sequentially. If a node has any children, its AbsoluteIndex is one less than the index of its first child. |
Count | property Count: Integer;
Use Count to determine how many child nodes belong to a tree node. Count includes only immediate children, and not their descendants. Count can be useful when iterating through the children of a tree node. |
Cut | property Cut: Boolean;
Use Cut to alter the appearance of the tree node when it is selected as part of a cut and paste operation. |
Data | property Data: Pointer;
Use the Data property to associate data with a tree node. Data allows applications to quickly access information about the entity represented by the node. |
Deleting | property Deleting: Boolean;
Deleting returns true if the node object is in the process of being deleted. Use Deleting to prevent infinite recursion in event handlers. |
DropTarget | property DropTarget: Boolean;
Use DropTarget to indicate that the node is a drag and drop target. When DropTarget is true, the node is drawn in a style used to indicate a drag and drop target. Note: Setting DropTarget to true does cause the node to automatically accept dragged objects when they are released. The application must still implement the drop behavior. |
Expanded | property Expanded: Boolean;
When a tree node is expanded, the minus button is shown if the ShowButtons property of the tree view is true and child nodes are displayed. Set Expanded to true to display the children of a node. Set Expanded to false to collapse the node, hiding all of its descendants. |
Focused | property Focused: Boolean;
Tree view nodes are not windowed controls and so can’t receive input focus. However, they can be edited by the user when the tree view control has focus. When Focused is true, the node is surrounded by a standard focus rectangle and the user can edit the label. Use Focused to determine if a particular node in a tree view can currently be edited by the user. |
Handle | property Handle: HWND;
Use Handle to obtain the handle of the tree view that owns the node. This handle can be passed as a parameter to Windows API function calls that require a handle to the tree view. |
HasChildren | property HasChildren: Boolean;
HasChildren is true if the node has subnodes, or false if the node has no subnodes. If ShowButtons of the tree view is true, and HasChildren is true, a plus (+) button will appear to the left of the node when it is collapsed, and a minus (-) button will appear when the node is expanded. Note: If a node has no children, setting HasChildren to true will show a (+) plus button, but will not add any child nodes and the node cannot be expanded. |
ImageIndex | property ImageIndex: TImageIndex;
Use the ImageIndex property with the Images property of the tree view to specify the image for the node in its normal state. |
Index | property Index: Longint;
Use Index to determine the position of the node relative to its sibling nodes. The first child of the parent node has an Index value of 0, and subsequent children are indexed sequentially. |
IsVisible | property IsVisible: Boolean;
A node is visible if it is on level 0 or if all its parents are expanded. IsVisible indicates whether the node is part of the current tree view image. It does not indicate whether or not the node is scrolled into view when the tree view image is larger than the size of the tree view control. |
Item | property Item[Index: Integer]: TTreeNode;
Use Item to access a child node based on its Index property. The first child node has an index of 0, the second an index of 1, and so on. |
ItemId | property ItemId: HTreeItem;
Use this property to reference the nodes when making Windows API calls or calling the GetNode method of the TTreeNodes that owns the item. |
Level | property Level: Integer;
The value of Level is 0 for nodes on the top level. The value of Level is 1 for their children, and so on. |
OverlayIndex | property OverlayIndex: Integer;
An overlay mask is an image drawn transparently over another image in the tree view. For example, to indicate that a node is no longer available, use an overlay image that puts an X over the current node's image. |
Owner | property Owner: TTreeNodes;
Use the Owner property to determine the owner of the tree node. Do not confuse Owner with the TreeView property. Owner is the list of nodes used by the tree view to manage its nodes. The TreeView property is the tree view that uses that list. |
Parent | property Parent: TTreeNode;
A Parent node is one level higher than the node and contains the node as a subnode. |
Selected | property Selected: Boolean;
Set Selected to true to select the node. The appearance of a selected node depends on whether it has the focus and on whether the system colors are used for selection. When a node becomes selected, the tree view's OnChanging and OnChanged events are triggered. |
SelectedIndex | property SelectedIndex: Integer;
Use the SelectedIndex property to specify an image to display when the tree node is selected. |
StateIndex | property StateIndex: Integer;
Use StateIndex to display an additional image for the node that reflects state information. If StateIndex is -1 then no state image is drawn. |
Text | property Text: string;
Use Text to specify the string that is displayed in the tree view. The value of Text can be assigned directly at run-time or can be set within the TreeView Items Editor while modifying the Items property of the TTreeView component. If the tree view allows users to edit its nodes, read Text to determine the value given the node by the user. |
TreeView | property TreeView: TCustomTreeView;
Use TreeView to determine the tree view associated with the tree node. |