Manipulating Image Lists

OverviewSample

The member function replaces an image in an image list () with a new image. This function is also useful if you need to dynamically increase the number of images in an image list object. The function dynamically changes the number of images stored in the image list. If you increase the size of the image list, call Replace to add images to the new image slots. If you decrease the size of the image list, the images beyond the new size are freed.

The member function removes an image from an image list. The member function can copy or swap images within an image list. This function allows you to indicate whether the source image should be copied to the destination index or the source and destination images should be swapped.

To create a new image list by merging two image lists, use the appropriate overload of the member function. This overload of Create merges the first image of the existing image lists, storing the resultant image in a new image list object. The new image is created by drawing the second image transparently over the first. The mask for the new image is the result of performing a logical-OR operation on the bits of the masks for the two existing images.

This is repeated until all images are merged and added to the new image list object.

You can write the image information to an archive by calling the member function, and read it back by calling the member function.

The , , and member functions allow you to manipulate the handle of the image list attached to the CImageList object, while the member function deletes the image list without destroying the CImageList object.

See Also   Windows Common Controls and MFC Classes