IListViewItem.OverlayIndex

Syntax

OverlayIndex: Integer;

Description

The OverlayIndex property determines index of the overlay.

Comments

Overlay is an image that is placed above the icon of the component element. ListView component. 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.

Example

Executing the example requires a form, the ListView component named ListView1 on it and the ImageList component named ImageList1.

The following set of images was loaded into the ImageList1 component:

Four elements were created in the ListView1 component. The following procedure is set as a handler of the OnCreate event of the form.

Sub TESTFormOnCreate(Sender: Object; Args: IEventArgs);
Var
    Items: IListViewItems;
    Item: IListViewItem;
Begin
    ImageList1.SetOverlay(ImageList1.Count - 10);
    ListView1.Style := ListViewStyle.SmallIcon;
    ListView1.SmallImages := ImageList1;
    Items := ListView1.Items;
    //First element
    Item := Items.Item(0);
    Item.ImageIndex := 0;
    Item.OverlayIndex := 0;
    //Second element
    Item := Items.Item(1);
    Item.ImageIndex := 1;
    Item.OverlayIndex := 0;
    //Third element
    Item := Items.Item(2);
    Item.ImageIndex := 2;
    //Forth element
    Item := Items.Item(3);
    Item.ImageIndex := 3;
End Sub TESTFormOnCreate;

The ImageList1 component is connected to the ListView1 component as a source of small 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 ListView1 component.

See also:

IListViewItem | IImageList.SetOverlay