Condividi tramite


CImageList::SetImageCount

Call this member function to reset the number of images in a CImageList object.

BOOL SetImageCount(
   UINT uNewCount 
);

Parameters

  • uNewCount
    The value specifying the new total number of images in the image list.

Return Value

Nonzero if successful; otherwise zero.

Remarks

If you call this member function to increase the number of images in the image list, then call Replace for each additional image to assign the new indexes to valid images. If you fail to assign the indexes to valid images, draw operations that create the new images will be unpredictable.

If you decrease the size of an image list by using this function, the truncated images are freed.

Example

// Set the image count of the image list to be 10 with
// all images being the system question mark icon.
m_myImageList.SetImageCount(10);
HICON hIcon = AfxGetApp()->LoadStandardIcon(IDI_QUESTION);

for (int i=0;i < 10;i++)
{
   m_myImageList.Replace(i, hIcon);
}

Requirements

Header: afxcmn.h

See Also

Reference

CImageList Class

Hierarchy Chart

Other Resources

CImageList Members