An Image List is a collection of same-sized images, each of which can be referred to by its zero-based index. Image lists are used to efficiently manage large sets of icons or bitmaps. Image lists are represented by CImageList class.
Sr.No.
Name & Description
1
Add
Adds an image or images to an image list.
2
Attach
Attaches an image list to a CImageList object.
3
BeginDrag
Begins dragging an image.
4
Copy
Copies an image within a CImageList object.
5
Create
Initializes an image list and attaches it to a CImageList object.
6
DeleteImageList
Deletes an image list.
7
DeleteTempMap
Called by the CWinApp idle-time handler to delete any temporaryCImageList object created by FromHandle.
8
Detach
Detaches an image list object from a CImageList object and returns a handle to an image list.
9
DragEnter
Locks updates during a drag operation and displays the drag image at a specified position.
10
DragLeave
Unlocks the window and hides the drag image so that the window can be updated.
11
DragMove
Moves the image that is being dragged during a drag-and-drop operation.
12
DragShowNolock
Shows or hides the drag image during a drag operation, without locking the window.
13
Draw
Draws the image that is being dragged during a drag-and-drop operation.
14
DrawEx
Draws an image list item in the specified device context. The function uses the specified drawing style and blends the image with the specified color.
15
DrawIndirect
Draws an image from an image list.
16
EndDrag
Ends a drag operation.
17
ExtractIcon
Creates an icon based on an image and mask in an image list.
18
FromHandle
Returns a pointer to a CImageList object when given a handle to an image list. If a CImageList object is not attached to the handle, a temporary CImageList object is created and attached.
19
FromHandlePermanent
Returns a pointer to a CImageList object when given a handle to an image list. If a CImageList object is not attached to the handle, NULL is returned.
20
GetBkColor
Retrieves the current background color for an image list.
21
GetDragImage
Gets the temporary image list that is used for dragging.
22
GetImageCount
Retrieves the number of images in an image list.
23
GetImageInfo
Retrieves information about an image.
24
GetSafeHandle
Retrieves m_hImageList.
25
Read
Reads an image list from an archive.
26
Remove
Removes an image from an image list.
27
Replace
Replaces an image in an image list with a new image.
28
SetBkColor
Sets the background color for an image list.
29
SetDragCursorImage
Creates a new drag image.
30
SetImageCount
Resets the count of images in an image list.
32
SetOverlayImage
Adds the zero-based index of an image to the list of images to be used as overlay masks.
33
Write
Writes an image list to an archive.
Let us create a new MFC Application MFCImageListDemo with the following settings.
Step 1 − Add bmp file as a resource in your application.
Step 2 − In header file of CMFCImageListDemoView class, add the following two variables.
CImageList ImageList;
int nImage;
Step 3 − Add the following code in constructor of CMFCImageListDemoView.