ILButton() [v1.0]

作者: tkoi, majkinetor 最近更新时间: 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")

关于函数的参数和返回值, 请参阅其源码.

备注

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.

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?t=53317

许可

此函数(集)是基于 GNU GPL 许可的开源项目. 想了解许可详情, 请参见 gpl-3.0.txt

示例

; #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