CImageList::SetOverlayImage

Call this function to add the zero-based index of an image to the list of images to be used as overlay masks.

BOOL SetOverlayImage(
   int nImage,
   int nOverlay 
);

Parameters

  • nImage
    Zero-based index of the image to use as an overlay mask.

  • nOverlay
    One-based index of the overlay mask.

Return Value

Nonzero if successful; otherwise 0.

Remarks

Up to four indices can be added to the list.

An overlay mask is an image drawn transparently over another image. Draw an overlay mask over an image by using the CImageList::Draw member function with the one-based index of the overlay mask specified by using the INDEXTOOVERLAYMASK macro.

Example

// Add a new image to the image list.
int nIndex = m_myImageList.Add(AfxGetApp()->LoadStandardIcon(IDI_QUESTION));

if (nIndex != -1)
{
   // Make the new image an overlay image.
   m_myImageList.SetOverlayImage(nIndex, 1);

   // Draw the first image in the image list with an overlay image.
   m_myImageList.Draw(&dc, 0, CPoint(0, 0), INDEXTOOVERLAYMASK(1));
}

Requirements

Header: afxcmn.h

See Also

Concepts

CImageList Class

CImageList Members

Hierarchy Chart

CImageList::Add