CImageList::SetImageCount

BOOL SetImageCount( UINT uNewCount );

Return Value

Nonzero if successful; otherwise zero.

Parameters

uNewCount

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

Remarks

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

If you call this member function to increase the number of images in the image list, then call Replace for each additional image to 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

// The pointer to my image list.
extern CImageList* pmyImageList;

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

for (int i=0;i < 10;i++)
{
   pmyImageList->Replace(i, hIcon);
}

CImageList OverviewClass MembersHierarchy Chart