PictureIndex

Applies to

ListViewItem, TreeViewItem

Description

The PictureIndex property identifies pictures in the control's Picture list. For ListViewItems, the index identifies the large, small, and state picture associated with the item.

For TreeViewItems, the index identifies the picture displayed to the left of the item label. If the index is 0, no picture is displayed. You can set the PictureIndex property only for TreeViewItems with scripts, but you can add pictures to the control's Picture list in the painter.

Usage

In a painter

To associate pictures with a Listview item:

  1. Select the Large Picture tab page, Small Picture tab page, or State tab page from the ListView control's Properties view.

  2. Do one of the following:

    • In the rows provided in the Picture Name field, type the complete path and name of the files containing the desired pictures.

    • Use the Browse button.

    • Select one or more pictures from the Stock Pictures list.

  3. Select the Items tab page from the ListView control's Properties view.

  4. Use the row numbers from the Picture Name list to specify the Picture Index for each List View Item on the Items tab page.

To add pictures to a TreeView control's picture list:

  1. Select the Pictures tab page from the TreeView control's Properties view.

  2. Do one of the following:

    • In the rows provided in the Picture Name field, type the complete path and name of the files containing the desired pictures.

    • Use the Browse button.

    • Select one or more pictures from the Stock Pictures list.

    You associate pictures in the TreeView control's picture list with TreeViewItems using scripts.

In scripts

This example illustrates how to get a ListViewItem object and change the value of PictureIndex:

listviewitem lvi
lv_1.GetItem(4, lvi)
lvi.PictureIndex = 2
lv_1.SetItem(4, lvi)

For more information about scripting ListView and TreeView controls, see the section called “Using ListView controls” in Application Techniques and Using TreeView Controls in Application Techniques.