AddStatePicture

Description

Adds a bitmap, icon, or cursor to the state image list.

Applies to

ListView and TreeView controls

Syntax

controlname.AddStatePicture ( picturename )

Argument

Description

controlname

The name of the ListView or TreeView control to which you are adding a bitmap, cursor, or icon

picturename

The name of the bitmap, icon, or cursor you are adding

Returns

Integer. Returns the picture index if it succeeds and -1 if an error occurs.

Usage

For ListViews in large icon view, the state picture is a picture displayed to the left of the large picture, by default in a smaller size. For TreeViews, the state picture is displayed to the left of the regular picture and the item is moved to the right to make room for it.

If you specify either StatePictureWidth or StatePictureHeight, the picture is scaled to the size specified by that property.

When a you add a bitmap, specify the color in the bitmap that will be transparent by setting the StatePictureMaskColor property before calling AddPicture. You can change the StatePictureMaskColor property between calls.

Examples

Example 1

This example adds the file star.ico to the state picture index of the ListView lv_files:

//Add state picture

integer index

index = lv_files.AddStatePicture("star.ico")

See also