ImageIndex: Integer;
The ImageIndex property determines index of the image that should be placed to the left of the text of the element in the first column of the component.
Executing the example requires a form, the DimensionTree component named DimensionTree1, the UiDimension component, that is a data source for the DimensionTree1, and the ImageList component containing the images set. ImageList is implemented in the Images property for the DimensionTree1 component. UiDimension is linked to a dictionary. The following procedure is implemented as the OnGetNodeImage event handler for the DimensionTree1 component.
Sub DimensionTree1OnGetNodeImage(Sender: Object; Args: IDimensionNodeGetImageEventArgs);
Begin
Select Case Args.State
Case DimensionViewerNodeState.None: Args.ImageIndex := -1;
Case DimensionViewerNodeState.Selected: Args.ImageIndex := 0;
Case DimensionViewerNodeState.Focused: Args.ImageIndex := 1;
Case DimensionViewerNodeState.SelectedFocused: Args.ImageIndex := 2;
Case DimensionViewerNodeState.Expanded: Args.ImageIndex := 3;
End Select;
End Sub DimensionTree1OnGetNodeImage;
On occurring the event of the element, for which the event was generated, the corresponding image is set according to the element state.
See also: