找回密码
 加入
搜索
查看: 1756|回复: 1

[GUI管理] GUICtrlCreateButton 的疑问[已解决]

[复制链接]
发表于 2011-10-9 13:43:59 | 显示全部楼层 |阅读模式
本帖最后由 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,而不用注册全局变量。现在不注册不行了!难道是新版本的问题?
发表于 2011-10-9 14:35:09 | 显示全部楼层
需要 #include <ButtonConstants.au3>
忘了哪版新增的

评分

参与人数 1金钱 +10 收起 理由
gzh888666 + 10 谢谢,知道了!比以前麻烦点!

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-9 10:18 , Processed in 0.076274 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表