回复 3# cks1203
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("test", 260, 280)
Dim $Checkbox[10]
$Checkbox[1] = GUICtrlCreateCheckbox("1", 50, 50, 25, 17)
$Checkbox[2] = GUICtrlCreateCheckbox("2", 120, 50)
$Checkbox[3] = GUICtrlCreateCheckbox("3", 190, 50)
$Checkbox[4] = GUICtrlCreateCheckbox("4", 50, 100)
$Checkbox[5] = GUICtrlCreateCheckbox("5", 120, 100)
$Checkbox[6] = GUICtrlCreateCheckbox("6", 190, 100)
$Checkbox[7] = GUICtrlCreateCheckbox("7", 50, 150)
$Checkbox[8] = GUICtrlCreateCheckbox("8", 120, 150)
$Checkbox[9] = GUICtrlCreateCheckbox("9", 190, 150)
For $i = 1 To 9
GUICtrlSetState($Checkbox[$i], $GUI_CHECKED)
Next
$Button1 = GUICtrlCreateButton("確認", 50, 240, 170, 25, $WS_GROUP)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Local $caption = ""
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
For $i = 1 To 9
If GUICtrlRead($Checkbox[$i]) == $GUI_CHECKED Then
If $caption == "" Then
$caption &= $i
Else
$caption &= "," & $i
EndIf
EndIf
Next
MsgBox(0, 0, $caption)
EndSwitch
WEnd
|