本帖最后由 gzh888666 于 2011-10-9 14:51 编辑 #include <GUIConstants.au3>
Opt("GUIOnEventMode",1)
Global Const $BS_ICON = 0x0040
$gui = GUICreate ("我的图标按钮",400,200)
GUISetBkColor (0xE0FFFF) ; 设置自己喜欢的色彩
GUISetOnEvent ($GUI_EVENT_CLOSE, "Event" )
$Button1 = GUICtrlCreateButton ("我的图标按钮", 10,20,40,40, $BS_ICON)
GUICtrlSetImage (-1, "shell32.dll",43)
$Button2 = GUICtrlCreateButton ("我的图标按钮", 80,20,40,40, $BS_ICON)
GUICtrlSetImage (-1, "shell32.dll",31)
$Button3 = GUICtrlCreateButton ("我的图标按钮", 150,20,40,40, $BS_ICON)
GUICtrlSetImage (-1, "shell32.dll",22)
GUICtrlSetOnEvent($Button1,"Event")
GUICtrlSetOnEvent($Button2,"Event")
GUICtrlSetOnEvent($Button3,"Event")
GUISetState ()
While 1
Sleep(100)
Wend
Func Event()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
MsgBox(0,"","我点的是1号")
Case $Button2
MsgBox(0,"","我点的是2号")
Case $Button3
MsgBox(0,"","我点的是3号")
EndSwitch
EndFunc
我记得以前是可以直接使用$BS_ICON,而不用注册全局变量。现在不注册不行了!难道是新版本的问题? |