ImageList_SetColorTable function

Sets the color table for an image list.


int ImageList_SetColorTable(
  _In_ HIMAGELIST himl,
  _In_ int        start,
  _In_ int        len,
  _In_ RGBQUAD    *prgb


himl [in]


A handle to the image list.

start [in]

Type: int

A zero-based color table index that specifies the first color table entry to set.

len [in]

Type: int

The number of color table entries to set.

prgb [in]


A pointer to an array of len RGBQUAD structures containing new color information for the color table of the DIB.

Return value

Type: int

If the function succeeds, it returns the number of color table entries set by the function. If the function fails, the return value is less than or equal to zero.


Only image lists created with the ILC_COLOR4 or ILC_COLOR8 flag have color tables. The color table of such an image list is typically set automatically by copying the color table of the first image added to the list (for example, through the ImageList_Add function) if that image is a DIB. If the first image added to the image list is not a DIB, then the color table of the halftone palette is used for ILC_COLOR8 image lists and the VGA color table is used for ILC_COLOR4.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]


Comctl32.dll (version 3.51 or later)

See also

Color Table