OverlayIndex: Integer;
The OverlayIndex property determines index of the overlay.
Overlay is an image that is placed above the icon of the component element. The SetOverlay method is used to identify overlays.
It is necessary to determine transparent color as an overlay for the selected image in the image collection of the ImageList component.
Executing the example requires a form, the TreeList component named TreeList on it and the ImageList component named ImageList1.
The following set of images has been loaded into the ImageList1 component:
Four nodes have been created in the TreeList1 component. The following procedure is set as a handler of the OnCreate event of the form.
Sub TestFormOnCreate(Sender: Object; Args: IEventArgs);
Var
Node: ITreeListNode;
Begin
//The last image from the collection will used as a covering mask
//Index that is set for the covering mask - 0
ImageList1.SetOverlay(ImageList1.Count - 1, 0);
TreeList1.Images := ImageList1;
//First node
Node := TreeList1.Nodes.FirstNode;
Node.ImageIndex := 0;
Node.OverlayIndex := 0;
//Second node
Node := Node.NextNode;
Node.ImageIndex := 1;
Node.OverlayIndex := 0;
//Third node
Node := Node.NextNode;
Node.ImageIndex := 2;
//Fourth node
Node := Node.NextNode;
Node.ImageIndex := 3;
End Sub TestFormOnCreate;
The ImageList1 component is connected to the TreeList1 component as a source of icons during form startup. The zero index of overlay is assigned to the last image from the collection of images of the ImageList1 component. This overlay is applied for the first two elements of the TreeList1 component.
See also: