ILButton() [v1.0]

Author: tkoi, majkinetor Last Modified: nonexistent


Creates an ImageList and associates it with a button.

This attaches an imagelist to a button, and, combined with a few dllcall functions, allows for more flexible and customizable image buttons. I've written a single small function wrapping most of the options that are available.

ILButton(HBtn, Images, Cx=16, Cy=16, Align="Left", Margin="1 1 1 1")

For more details of the functions's parameters and return value, please see it's source code.

Remarks

This module is part of the Forms Framework package.

Original code by tkoi, See:
* http://www.autohotkey.com/forum/viewtopic.php?p=247168

It does require at least Windows XP.

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?t=53317

License

The functions is an open source item under the GNU GPL license. For details, please see gpl-3.0.txt

Example

; #Include ILButton.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance force

; Example by tkoi at http://www.autohotkey.com/forum/viewtopic.php?p=247168#247168
Gui, +ToolWindow +AlwaysOnTop
Loop 5 {
   Gui, Add, Button, w64 h32 xm hwndhBtn
      ILButton(hBtn, "user32.dll:" A_Index-1, 16, 16, A_Index-1)
   Gui, Add, Button, w100 h32 x+10 hwndhBtn, text
      ILButton(hBtn, "user32.dll:" A_Index-1, 16, 16, A_Index-1)
   }
Gui, Add, Button, xm w174 h48 vStates hwndhBtn, pushbuttonstates
   ILButton(hBtn, "user32.dll:0|:1|:2|:3|:4|:5", 32, 32, 0, "16,1,-16,1")
Gui, Add, Button, w100 h26 xm+74 gToggle, Enable/disable

Gui, Show, , ILButton demo
return

Toggle:
   GuiControlGet, s, Enabled, States
   GuiControl, Disable%s%, States
   return

GuiClose:
GuiEscape:
   ExitApp
   return