Sets the picture indexes for all items at a particular level.
TreeView controls
treeviewname.SetLevelPictures ( level, pictureindex, selectedpictureindex, statepictureindex, overlaypictureindex)
Argument |
Description |
---|---|
treeviewname |
The TreeView control in which you want to set the pictures for a given TreeView level |
level |
The TreeView level for which you are setting the picture indexes |
pictureindex |
An index from the regular picture list specifying the picture to be displayed when the item is not selected |
selectedpictureindex |
An index from the regular picture list specifying the picture to be displayed when the item is selected |
statepictureindex |
An index from the state picture list specifying the picture to be displayed to the left of the regular picture |
overlaypictureindex |
An index from the overlay picture list specifying the picture to be displayed on top of the regular picture |
Integer. Returns 1 if it succeeds and -1 if an error occurs.
To set pictures for individual items, call GetItem, set the picture properties, and call SetItem to copy the changes to the TreeView. You must specify a value for all four indexes. To display nothing, specify 0.
This example sets the pictures for TreeView level 3, then inserts two new TreeView items:
long ll_tvi, ll_child, ll_child2
int li_pict, li_level
treeviewitem l_tvi
li_level = 6
tv_list.SetLevelPictures( 3, li_level, li_level, &
li_level, li_level)
ll_tvi = tv_list.FindItem(RootTreeItem! , 0)
ll_child = tv_list.InsertItemLast(ll_tvi, "Walton",2)
ll_child2 = tv_list.InsertItemLast(ll_child, &
"Spitfire Suite", li_level)
tv_list.ExpandItem(ll_child)
tv_list.SetFirstVisible(ll_child)