Cx = 16,
Cy = 16,
Align = "Left",
Margin = "1 1 1 1")

Creates an ImageList and associates it with a button.


HBtnHandle of a buttton.
ImagesA pipe delimited list of images in form “FileName[:zeroBasedIndex]” or ImageList handle.  Any position can be omitted in which case icon for state “normal” is used.
CxWidth of the image in pixels.  By default 16.
CyHeight of the image in pixels.  By default 16.
AlignOne of the word: Left (default), Right, Top, Bottom, Center.
MarginMargin around the icon.  A space separated list of four integers in form “left top right bottom”.


  • File must be of type exe, dll, ico, cur, ani or bmp.
  • There are 5 states: normal, hot (hover), pressed, disabled, defaulted (focused), stylushot.
  • If only one image is specified, it will be used for all the button’s states
  • If fewer than six images are specified, nothing is drawn for the states without images
  • Omit “file” to use the last file specified ( “states.dll:0|:1|:2|:3|:4|:5” )
  • Omitting an index is the same as specifying 0.


Handle of the ImageList if operation was completed or 0 otherwise.


Within Aero theme (WinOS >= Vista), a defaulted (focused) button fades between images 5 and 6.  Each succesifull call to this function creates new ImageList.  If you are calling this function more times for single button control, freeing previous ImageList is your responsibility.