本帖最后由 lixiaolong 于 2011-4-25 22:30 编辑
回复 1# mo_shaojie
看看这样可不可以?
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Dim $Checkbox[19]
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Checkbox[1] = GUICtrlCreateCheckbox("Checkbox1", 48, 32, 97, 17)
$Checkbox[2] = GUICtrlCreateCheckbox("Checkbox2", 48, 64, 97, 17)
$Checkbox[3] = GUICtrlCreateCheckbox("Checkbox3", 48, 104, 97, 17)
$Checkbox[4] = GUICtrlCreateCheckbox("Checkbox4", 48, 136, 97, 17)
$Checkbox[5] = GUICtrlCreateCheckbox("Checkbox5", 48, 176, 97, 17)
$Checkbox[6] = GUICtrlCreateCheckbox("Checkbox6", 48, 216, 97, 17)
$Checkbox[7] = GUICtrlCreateCheckbox("Checkbox7", 48, 256, 97, 17)
$Checkbox[8] = GUICtrlCreateCheckbox("Checkbox8", 48, 296, 97, 17)
$Checkbox[9] = GUICtrlCreateCheckbox("Checkbox9", 48, 336, 97, 17)
$Checkbox[10] = GUICtrlCreateCheckbox("Checkbox10", 48, 376, 97, 17)
$Checkbox[11] = GUICtrlCreateCheckbox("Checkbox11", 48, 416, 97, 17)
$Checkbox[12] = GUICtrlCreateCheckbox("Checkbox12", 216, 32, 97, 17)
$Checkbox[13] = GUICtrlCreateCheckbox("Checkbox13", 216, 64, 97, 17)
$Checkbox[14] = GUICtrlCreateCheckbox("Checkbox14", 216, 104, 97, 17)
$Checkbox[15] = GUICtrlCreateCheckbox("Checkbox15", 216, 144, 97, 17)
$Checkbox[16] = GUICtrlCreateCheckbox("Checkbox16", 216, 184, 97, 17)
$Checkbox[17] = GUICtrlCreateCheckbox("Checkbox17", 216, 224, 97, 17)
$Checkbox[18] = GUICtrlCreateCheckbox("Checkbox18", 216, 264, 97, 17)
$Checkbox19 = GUICtrlCreateCheckbox("全选", 392, 312, 97, 17)
$Checkbox20 = GUICtrlCreateCheckbox("推荐", 392, 352, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox20
For $i = 1 To UBound($Checkbox) - 1
GUICtrlSetState($Checkbox[$i], $GUI_UNCHECKED)
Next
For $i = 10 To 13
If GUICtrlRead($Checkbox20) = $GUI_UNCHECKED Then
$Checkd = $GUI_UNCHECKED
Else
$Checkd = $GUI_CHECKED
EndIf
If GUICtrlRead($Checkbox19, 1) = "全不选" Then
GUICtrlSetState($Checkbox19, $GUI_UNCHECKED)
GUICtrlSetData($Checkbox19, "全选")
EndIf
GUICtrlSetState($Checkbox[$i], $Checkd)
Next
Case $Checkbox19
If GUICtrlRead($Checkbox19, 1) = "全选" Then
$Checkd = $GUI_CHECKED
GUICtrlSetData($Checkbox19, "全不选")
GUICtrlSetState($Checkbox20, $GUI_UNCHECKED)
Else
$Checkd = $GUI_UNCHECKED
GUICtrlSetData($Checkbox19, "全选")
EndIf
For $i = 1 To UBound($Checkbox) - 1
GUICtrlSetState($Checkbox[$i], $Checkd)
Next
EndSwitch
WEnd
要是不想把"全选" 改成 "全不选" 的话可以改成"全选 "(加一个空格),这样就看不出来了. |