#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("全选\全不选-test", 260, 280)
Dim $Checkbox[10], $ztbj = 1
$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)
$Button1 = GUICtrlCreateButton("全选", 50, 210, 170, 25, $WS_GROUP)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If $ztbj = 1 Then
For $i = 1 To 9
GUICtrlSetState($Checkbox[$i], $GUI_CHECKED)
Next
GUICtrlSetData($Button1, "全不选")
$ztbj = 0
Else
For $i = 1 To 9
GUICtrlSetState($Checkbox[$i], $GUI_UNCHECKED)
Next
GUICtrlSetData($Button1, "全选")
$ztbj = 1
EndIf
EndSwitch
WEnd
|