Image List Control (CImageList) is a collection of images of the same size, each set with 0 as the index ordinal number of the image, and the image list is usually made up of large icons or bitmaps that contain transparent bitmap mode. The WINDOWS32 bit application interface function API can be used to draw, build, and delete images, and to add, delete, replace, and drag images. Image List control provides a basic way to control image lists, which can be implemented in WINDOWS95 and later versions.
(i) object structure of image control
1, image control of the data members
M_himagelist the control handle of the attached image object
2, the establishment of image control method
Cimagelist&imagelist establish image control object structure
Create Initializes a list of images and binds objects
Image control is established in the following ways:
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& imagelist1, int nImage1, CImageList& imagelist2
,int nImage2,int dx, int dy );
The meaning of each parameter is: CX defines the width of the image, in pixels; Cy defines the height of the images, in pixels; nflags determines the type of image list to create, which can be a combination of the following values: Ilc_color, Ilc_color4, Ilc_color8, ilc_ COLOR16, Ilc_color24, Ilc_color32, ILC_COLORDDB, and ilc_mask;ninitial are used to determine the number of images the image list contains; Ngrow determines the number of images that can be controlled by the image list.
Nbitmapid the bitmap flag value used to determine the contact of the image list; Crmask represents the color screen bit;
Lpszbitmapid is used to determine the identity string containing the bitmap resource;
ImageList1 point to a pointer to an image list control object; NImage1 the number of images contained in the image list 1; imagelist2 A pointer to an image list control object; NImage2 the number of images contained in image List 2; dx represents the image width in pixels DY represents the height of an image in pixels.
Similarly, the establishment of image control also includes two steps, first set up the image list structure, and then set up the image list control.
3, the image control attribute class
The attribute class for image control includes returning m_himagelist. Control handle Getsafehandle, getting the number of images in the image list GetImageCount, setting the background color of the image list SetBkColor, Get the background color setbkcolor of the image list and get the information about the image SetBkColor.
4, the Image control operation method
The action methods of image control include binding an image list to an object attach, unbinding an image list on an object, returning a handle detach, deleting an image list Deleteimagelist, Add an image to the image list add and remove an image from the image list.