#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("", 623, 449)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
Global $Checkbox[8], $iCheckbox[8] = ["1", "0", "1", "0", "1", "0", "1", "1"]
For $ii = 0 To 7
$Checkbox[$ii] = GUICtrlCreateCheckbox("榴莲" & $ii, 64 + 16 * BitAND($ii, 1), 40 + 24 * $ii, 97, 17)
Next
$Button1 = GUICtrlCreateButton("Button1", 56, 264, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func Button1Click()
For $i = 0 To 7
If $iCheckbox[$i] = 1 Then
GUICtrlSetState($Checkbox[$i], $GUI_CHECKED)
MsgBox(0, "", "选中了" & "$iCheckbox[" & $i & "] 文本是" & ControlGetText("", "", $Checkbox[$i]))
EndIf
Next
EndFunc
Func Form1Close()
Exit
EndFunc
|