OverlayIndex: Integer;
The OverlayIndex property determines index of the covering mask.
Covering mask is an image that is placed over the element icon of the component. ListView. The SetOverlay method is used to identify covering masks.
It is necessary to determine transparent color as covering mask for the selected image in the image collection of the ImageList component.
Executing the example requires a form, the ListView component named ListView1 positioned 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 - 1, 0);
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 launching. The zero index of covering mask is assigned to the last image from the collection of images of the ImageList1 component. This covering mask is applied for the first two elements of the ListView1 component.
See also: