|
本帖最后由 chenjt819 于 2009-7-23 12:48 编辑
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("全选\反选", 261, 251, 340, 162)
$Checkbox1 = GUICtrlCreateCheckbox("1", 50, 50, 25, 17)
$Checkbox2 = GUICtrlCreateCheckbox("2", 120, 50, 25, 17)
$Checkbox3 = GUICtrlCreateCheckbox("3", 190, 50, 25, 17)
$Checkbox4 = GUICtrlCreateCheckbox("4", 50, 100, 25, 17)
$Checkbox5 = GUICtrlCreateCheckbox("5", 120, 100, 25, 17)
$Checkbox6 = GUICtrlCreateCheckbox("6", 190, 100, 25, 17)
$Checkbox7 = GUICtrlCreateCheckbox("7", 50, 150, 25, 17)
$Checkbox8 = GUICtrlCreateCheckbox("8", 120, 150, 25, 17)
$Checkbox9 = GUICtrlCreateCheckbox("9", 190, 150, 25, 17)
$Group1 = GUICtrlCreateGroup("10", 24, 24, 209, 169)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button = GUICtrlCreateButton("全选", 90, 210, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
Dim $Checkbox,$B=True
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
If $B=True Then
For $i=3 To 11
GUICtrlSetState($Checkbox&$i, $GUI_CHECKED)
GUICtrlSetData($Button,'反选')
Next
$B=False
Else
For $i=3 To 11
If GUICtrlRead($Checkbox&$i)=1 then
GUICtrlSetState($Checkbox&$i, $GUI_UNCHECKED )
Elseif GUICtrlRead($Checkbox&$i)=4 then
GUICtrlSetState($Checkbox&$i, $GUI_CHECKED)
Endif
Next
$B=True
GUICtrlSetData($Button,'全选')
Endif
EndSwitch
WEnd
为什么是 For $i=3 To 11 而不是 For $i=1 To 9
不是 Checkbox1 - Checkbox9 吗? |
|