BOOL GetItemImage( HTREEITEM hItem, int& nImage, int& nSelectedImage ) const;
Return Value
Nonzero if successful; otherwise 0.
Parameters
hItem
The handle of the item whose image is to be retrieved.
nImage
An integer that receives the index of the item’s image within the tree view control’s image list.
nSelectedImage
An integer that receives the index of the item’s selected image within the tree view control’s image list.
Remarks
Each item in a tree view control can have a pair of bitmapped images associated with it. The images appear on the left side of an item’s label. One image is displayed when the item is selected, and the other is displayed when the item is not selected. For example, an item might display an open folder when it is selected and a closed folder when it is not selected.
Call this function to retrieve the index of the item’s image and its selected image within the tree view control’s image list.
Example
// The pointer to my tree control.
extern CTreeCtrl* pmyTreeCtrl;
// The item whose children will be checked.
extern HTREEITEM hmyItem;
// If the selected image is the same as the nonselected image
// then make the selected image index 0.
if (pmyTreeCtrl->ItemHasChildren(hmyItem))
{
HTREEITEM hItem = pmyTreeCtrl->GetChildItem(hmyItem);
int nImage, nSelectedImage;
while (hItem != NULL)
{
pmyTreeCtrl->GetItemImage(hItem, nImage, nSelectedImage);
if (nImage == nSelectedImage)
{
pmyTreeCtrl->SetItemImage(hItem, nImage, 0);
}
hItem = pmyTreeCtrl->GetNextSiblingItem(hItem);
}
}
CTreeCtrl Overview | Class Members | Hierarchy Chart
See Also CTreeCtrl::SetItemImage, CImageList