CImageList

Win32++

CImageList Class

Description

The CImageList class adds support for the image lists. An image list is a collection of images of the same size, each of which can be referred to by its index. Image lists are used to efficiently manage large sets of icons or bitmaps. All images in an image list are contained in a single, wide bitmap in screen device format. An image list can also include a monochrome bitmap that contains masks that are used to draw images transparently.

Refer to the documentation that ships with the Microsoft Windows Software Development Kit for more information on the use of image lists. 

CImageList Members

CImageList
CImageList();
Constructs a CImageList.
Add
int Add(CBitmap* pbmImage, CBitmap* pbmMask) ;
int Add(CBitmap* pbmImage, COLORREF crMask);
int Add(HICON hIcon);
Adds an image or images to an image list. Attach
void Attach(HIMAGELIST hImageList);
Attaches an existing image list to this CImageList. BeginDrag
int Add(CBitmap* BOOL BeginDrag(int nImage, CPoint ptHotSpot) const;, CBitmap* pbmMask) ;
Begins dragging an image. Create
BOOL Create(int cx, int cy, UINT nFlags, int nInitial, int nGrow);
BOOL Create(UINT nBitmapID, int cx, int nGrow, COLORREF crMask);
BOOL Create(LPCTSTR lpszBitmapID, int cx, int nGrow, COLORREF crMask);
BOOL Create(CImageList* pImageList);
Creates the image list and assigns it to the CImageList. CreateDisabledImageList
HIMAGELIST CreateDisabledImageList( HIMAGELIST himlNormal );
Creates a gray scale image list from the specified color image list. DeleteImageList
void DeleteImageList();
Destroys the image list. Detach
HIMAGELIST Detach();
Detaches the HIMAGELIST from this CImageList. If the HIMAGELIST is not detached it will be destroyed when this CImageList is deconstructed. DragEnter
BOOL DragEnter(CWnd* pWndLock, CPoint point) const;
Displays the drag image at the specified position within the window. DragLeave
BOOL DragLeave(CWnd* pWndLock) const;
Unlocks the specified window and hides the drag image, allowing the window to be updated. DragMove
BOOL DragMove(CPoint pt) const;
Moves the image that is being dragged during a drag-and-drop operation. This function is typically called in response to a WM_MOUSEMOVE message. DragShowNolock
BOOL DragShowNolock(BOOL bShow) const;
Shows or hides the drag image during a drag operation, without locking the window. Draw
BOOL Draw(CDC* pDC, int nImage, POINT pt, UINT nStyle) const;
Draws an image list item in the specified device context. DrawEx
BOOL DrawEx(CDC* pDC, int nImage, POINT pt, SIZE sz, COLORREF clrBk, COLORREF clrFg, UINT nStyle) const;
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. DrawIndirect
BOOL DrawIndirect(IMAGELISTDRAWPARAMS* pimldp);
Draws an image list image based on an IMAGELISTDRAWPARAMS structure. FromHandle
static CImageList* FromHandle(HIMAGELIST hImageList);
Returns the CImageList associated with the specified image list handle. If a CImageList object doesn't already exist, a temporary CImageList object is created. This temporary CImageList will be deleted sometime after the processing of the current message is complete.. GetIcon
HICON GetIcon(int iImage, UINT nFlags) const;
Creates an icon from an image and mask in an image list. GetIcon
HICON GetIcon(int iImage, UINT nFlags) const;
Creates an icon from an image and mask in an image list. GetIconSize
BOOL GetIconSize(int* cx, int* cy) const;
Retrieves the dimensions of images in an image list. GetImageCount
int GetImageCount() const;
Retrieves the number of images in an image list. GetImageInfo
BOOL GetImageInfo(int nImage, IMAGEINFO* pImageInfo) const;
Retrieves information about an image. Remove
BOOL Remove(int nImage) const;
Removes an image from an image list. Replace
BOOL Replace(int nImage, CBitmap* pbmImage, CBitmap* pbmMask) const;
int Replace(int nImage, HICON hIcon) const;
Replaces an image in an image list with a new image. operator HIMAGELIST
operator HIMAGELIST () const;
Retrieves the image list's handle.

Remarks

A CImageList object will automatically destroy the image list associated with it when its destructor is called. Detach the HIMAGELIST if you don't want it destroyed when the CImageList object goes out of scope.

Summary Information

Header file controls.h
Win32/64 support Yes
WinCE support Yes
Library required Comctl32.lib