CImageList::ExtractIcon
Call this function to create an icon based on an image and its related mask in an image list.
HICON ExtractIcon(
int nImage
);
Параметры
- nImage
Zero-based index of the image.
Возвращаемое значение
Handle of the icon if successful; otherwise NULL.
Заметки
This method relies on the behavior of the ImageList_ExtractIcon macro to create the icon. Refer to the ImageList_ExtractIcon macro for more information on icon creation and cleanup.
Пример
int i, dx, cx, cy, nCount = m_myImageList.GetImageCount();
HICON hIcon;
::ImageList_GetIconSize(m_myImageList, &cx, &cy);
// Draw the images of the image list on the DC.
for (dx = 0, i = 0; i < nCount; i++)
{
hIcon = m_myImageList.ExtractIcon(i);
dc.DrawIcon(dx, 0, hIcon);
dx += cx;
}
Требования
Header: afxcmn.h