CImageList::SetOverlayImage

BOOL SetOverlayImage( int nImage, int nOverlay );

Return Value

Nonzero if successful; otherwise 0.

Parameters

nImage

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

nOverlay

One-based index of the overlay mask.

Remarks

Call this function to add the zero-based index of an image to the list of images to be used as overlay masks. 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

// The pointer to my image list.
extern CImageList* pmyImageList;
// The position of where to draw the image.
extern CPoint myPoint;
// The DC to draw the image on.
extern CDC* pmyDC;

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

if (nIndex != -1)
{
   // Make the new image an overlay image.
   pmyImageList->SetOverlayImage(nIndex, 1);
   
   // Draw the first image in the image list with an overlay image.
   pmyImageList->Draw(pmyDC, 0, myPoint, INDEXTOOVERLAYMASK(1));
}

CImageList OverviewClass MembersHierarchy Chart

See Also   CImageList::Add