Compartilhar via


CImageList::Replace

Call this function to replace an image in an image list with a new image.

BOOL Replace( 
   int nImage, 
   CBitmap* pbmImage, 
   CBitmap* pbmMask  
); 
int Replace( 
   int nImage, 
   HICON hIcon  
);

Parameters

  • nImage
    Zero-based index of the image to replace.

  • pbmImage
    A pointer to the bitmap containing the image.

  • pbmMask
    A pointer to the bitmap containing the mask. If no mask is used with the image list, this parameter is ignored.

  • hIcon
    A handle to the icon that contains the bitmap and mask for the new image.

Return Value

The version returning BOOL returns nonzero if successful; otherwise 0.

The version returning int returns the zero-based index of the image if successful; otherwise – 1.

Remarks

Call this member function after calling SetImageCount to assign the new, valid images to the placeholder image index numbers.

Example

See the example for CImageList::SetImageCount.

Requirements

Header: afxcmn.h

See Also

Reference

CImageList Class

Hierarchy Chart

CImageList::Remove