那应该是这样了~希望能帮到你~
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
Opt("GUIOneventMode",1)
Dim $Button[24]
$WinMain = GUICreate("测试", 450, 300) ;创建主窗口
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ;注册窗口关闭事件到函数_Exit
$neirong1 = "系统公告:";定义neirong1为公告内容1
$neirong2 = "欢迎来到本网吧!";定义neirong2为公告内容2
$Label1 = GUICtrlCreateLabel($neirong1 & $neirong2, 5, 280, 580, 15, $SS_CENTERIMAGE);定义需要移动的标签
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT);使标签背景透明
;GUICtrlCreateButton ( "文本", 左侧, 上方 [, 宽度 [, 高度 [, 样式 [, 扩展样式]]]] )
$Button[0] = GUICtrlCreateButton("按键1", 0, 0, 110, 49,$BS_FLAT);显示子窗口 1
$Button[1] = GUICtrlCreateButton("按键2", 113, 0, 110, 49,$BS_FLAT);显示子窗口 2
$Button[2] = GUICtrlCreateButton("按键3", 226, 0, 110, 49,$BS_FLAT);显示子窗口 3
$Button[3] = GUICtrlCreateButton("按键4", 339, 0, 110, 49,$BS_FLAT);显示子窗口 4
$Button[4] = GUICtrlCreateButton("按键5", 0, 50, 110, 49,$BS_FLAT);显示子窗口 5
$Button[5] = GUICtrlCreateButton("按键6", 113, 50, 110, 49,$BS_FLAT);显示子窗口 6
$Button[6] = GUICtrlCreateButton("按键7", 226, 50, 110, 49,$BS_FLAT);显示子窗口 7
$Button[7] = GUICtrlCreateButton("按键8", 339, 50, 110, 49,$BS_FLAT);显示子窗口 8
$WinSub1 = GUICreate("子窗口", 220, 60) ;创建子窗口1
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button[8] = GUICtrlCreateButton("确认", 0, 0, 100, 50,$BS_DEFPUSHBUTTON)
$Button[9]= GUICtrlCreateButton("取消", 110, 0, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
$WinSub2 = GUICreate("子窗口", 220, 60) ;创建子窗口2
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button[10]= GUICtrlCreateButton("确认", 0, 0, 100, 50,$BS_DEFPUSHBUTTON)
$Button[11]= GUICtrlCreateButton("取消", 110, 0, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
$WinSub3 = GUICreate("子窗口", 220, 60) ;创建子窗口2
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button[12] = GUICtrlCreateButton("确认", 0, 0, 100, 50,$BS_DEFPUSHBUTTON)
$Button[13] = GUICtrlCreateButton("取消", 110, 0, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
$WinSub4 = GUICreate("子窗口", 220, 60) ;创建子窗口2
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button[14] = GUICtrlCreateButton("确认", 0, 0, 100, 50,$BS_DEFPUSHBUTTON)
$Button[15] = GUICtrlCreateButton("取消", 110, 0, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
$WinSub5 = GUICreate("子窗口", 220, 60) ;创建子窗口2
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button[16] = GUICtrlCreateButton("确认", 0, 0, 100, 50,$BS_DEFPUSHBUTTON)
$Button[17] = GUICtrlCreateButton("取消", 110, 0, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
$WinSub6 = GUICreate("子窗口", 220, 60) ;创建子窗口2
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button[18] = GUICtrlCreateButton("确认", 0, 0, 100, 50,$BS_DEFPUSHBUTTON)
$Button[19] = GUICtrlCreateButton("取消", 110, 0, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
$WinSub7 = GUICreate("子窗口", 220, 60) ;创建子窗口2
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button[20] = GUICtrlCreateButton("确认", 0, 0, 100, 50,$BS_DEFPUSHBUTTON)
$Button[21] = GUICtrlCreateButton("取消", 110, 0, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
$WinSub8 = GUICreate("子窗口", 220, 60) ;创建子窗口2
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button[22] = GUICtrlCreateButton("确认", 0, 0, 100, 50,$BS_DEFPUSHBUTTON)
$Button[23] = GUICtrlCreateButton("取消", 110, 0, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
For $I = 22 to 0 Step -1
GUICtrlSetOnEvent($Button[$I],"GUICtrlMsg") ;注册总共的六个按钮点击事件到函数 GUICtrlMsg
;请区分 GUISetOnEvent 和 GUICtrlSetOnEvent的区别
Next
GUISwitch($WinMain) ;切换当前窗口到主窗口
GUISetState(@SW_SHOW) ;显示当前窗口
$b = 1
While 1
If $b = 630 Then $b = 1
Sleep(20)
ControlMove($WinMain, "", $Label1, 450 - $b, 280)
$b += 1
WEnd
Func GUICtrlMsg()
Switch @GUI_CtrlId;选择事件 ID 或 控件 ID
Case $GUI_EVENT_CLOSE;如果点下的是$GUI_EVENT_CLOSE(关闭)
GUISetState(@SW_HIDE,@GUI_WinHandle); 隐藏产生事件的窗口
Case $Button[0]
GUISetState(@SW_SHOW,$WinSub1); 显示 子窗口 1
Case $Button[1]
GUISetState(@SW_HIDE,$WinSub1); 隐藏 子窗口 2
Case $Button[2]
GUISetState(@SW_SHOW,$WinSub2); 显示 子窗口 2
Case $Button[3]
GUISetState(@SW_SHOW,$WinSub3); 显示 子窗口 3
Case $Button[4]
GUISetState(@SW_SHOW,$WinSub4); 显示 子窗口 4
Case $Button[5]
GUISetState(@SW_SHOW,$WinSub5); 显示 子窗口 5
Case $Button[6]
GUISetState(@SW_SHOW,$WinSub6); 显示 子窗口 6
Case $Button[7]
GUISetState(@SW_SHOW,$WinSub7); 显示 子窗口 7
Case $Button[8]
GUISetState(@SW_SHOW,$WinSub8); 显示 子窗口 8
Case $Button[8]
MsgBox(48,0,"你点了主窗口 1 中的第一个按钮")
GUISetState(@SW_HIDE,$WinSub2); 隐藏 子窗口 2
Case $Button[3]
MsgBox(48,0,"你点了主窗口 2 中的第一个按钮")
Case $Button[4]
GUISetState(@SW_HIDE,$WinSub2); 隐藏 子窗口 2
Case $Button[5]
MsgBox(48,0,"你点了主窗口 3 中的第一个按钮")
Case $Button[6]
GUISetState(@SW_HIDE,$WinSub3); 隐藏 子窗口 3
Case $Button[7]
MsgBox(48,0,"你点了主窗口 4 中的第一个按钮")
Case $Button[8]
GUISetState(@SW_HIDE,$WinSub4); 隐藏 子窗口 4
Case $Button[9]
MsgBox(48,0,"你点了主窗口 5 中的第一个按钮")
Case $Button[10]
GUISetState(@SW_HIDE,$WinSub5); 隐藏 子窗口 5
Case $Button[11]
MsgBox(48,0,"你点了主窗口 6 中的第一个按钮")
Case $Button[12]
GUISetState(@SW_HIDE,$WinSub6); 隐藏 子窗口 6
Case $Button[13]
MsgBox(48,0,"你点了主窗口 7 中的第一个按钮")
Case $Button[14]
GUISetState(@SW_HIDE,$WinSub7); 隐藏 子窗口 7
Case $Button[15]
MsgBox(48,0,"你点了主窗口 8 中的第一个按钮")
Case $Button[16]
GUISetState(@SW_HIDE,$WinSub8); 隐藏 子窗口 8
EndSwitch
EndFunc
Func _Exit()
Exit
EndFunc
|