Creating an Image List
To create an image list, use the
ImageList_Create function, specifying the type of image list to create (unmasked or masked);
the width and height, in pixels, of the images; the number of images you intend
to add to the image list; and the amount of images by which the list can grow
when it is resized to accommodate additional images. The common control DLL
contains the executable code for the image list functions. You must ensure that the
library is loaded by using the
InitCommonControls function before making any calls to image list functions.
The following example creates a masked image list and uses the
ImageList_AddIcon function to add two icons to the list.
// AddIconsToImageList - creates a masked image list and adds some
// icons to it.
// Returns the handle of the new image list.
// hinst - handle of the application instance
//
// Global variables and constants
// g_nBird and g_nTree - indexes of the images
// CX_ICON and CY_ICON - width and height of the icon
// NUM_ICONS - number of icons to add to the image list
extern int g_nBird, g_nTree;
#define CX_ICON 32
#define CY_ICON 32
#define NUM_ICONS 3
HIMAGELIST AddIconsToImageList(HINSTANCE hinst)
{
HIMAGELIST himlIcons; // handle of new image list
HICON hicon; // handle of icon
// Ensure that the common control DLL is loaded.
InitCommonControls();
// Create a masked image list large enough to hold the icons.
himlIcons = ImageList_Create(CX_ICON, CY_ICON, TRUE, NUM_ICONS, 0);
// Load the icon resources, and add the icons to the image list.
hicon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_BIRD));
g_nBird = ImageList_AddIcon(himlIcons, hicon);
hicon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_TREE));
g_nTree = ImageList_AddIcon(himlIcons, hicon);
return himlIcons;
}
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database