#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("guioneventmode",1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Tab中的全选示例", 339, 254, 193, 125)
GUISetIcon("E:\ICON\843.ico", -1)
$tab = GUICtrlCreateTab(10, 10, 319, 200)
$tab0 = GUICtrlCreateTabItem("注册")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
$Checkbox1 = GUICtrlCreateCheckbox("注册1", 32, 34, 73, 17)
$Checkbox2 = GUICtrlCreateCheckbox("注册2", 32, 74, 73, 17)
$Checkbox3 = GUICtrlCreateCheckbox("注册3", 32, 114, 73, 17)
$Checkbox4 = GUICtrlCreateCheckbox("注册4", 32, 154, 73, 17)
$tab1 = GUICtrlCreateTabItem("测试")
$Checkbox5 = GUICtrlCreateCheckbox("测试5", 32, 34, 73, 17)
$Checkbox6 = GUICtrlCreateCheckbox("测试6", 32, 74, 73, 17)
$Checkbox7 = GUICtrlCreateCheckbox("测试7", 32, 114, 73, 17)
$Checkbox8 = GUICtrlCreateCheckbox("测试8", 32, 154, 73, 17)
$tab2 = GUICtrlCreateTabItem("学习")
$Checkbox9 = GUICtrlCreateCheckbox("学习9", 32, 34, 73, 17)
$Checkbox10 = GUICtrlCreateCheckbox("学习10", 32, 74, 73, 17)
$Checkbox11 = GUICtrlCreateCheckbox("学习11", 32, 114, 73, 17)
$Checkbox12 = GUICtrlCreateCheckbox("学习12", 32, 154, 73, 17)
GUICtrlCreateTabItem("") ; end tabitem definition
$Button1 = GUICtrlCreateButton("全选", 16, 220, 97, 25, 0)
$Button2 = GUICtrlCreateButton("全不选", 126, 220, 97, 25, 0)
GUICtrlSetOnEvent($tab,"tab")
GUICtrlSetOnEvent($Button1,"BUTTON")
GUICtrlSetOnEvent($Button2,"BUTTON")
GUISetOnEvent($GUI_EVENT_CLOSE,"CLOSE")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(1000)
WEnd
Func CLOSE()
Exit
EndFunc
Func BUTTON()
Switch @GUI_CtrlId
Case $Button1
For $i=1 to 12
$T="Checkbox"&$i
GUICtrlSetState(Eval($T),$GUI_CHECKED)
Next
Case $Button2
For $i=1 to 12
$T="Checkbox"&$i
GUICtrlSetState(Eval($T),$GUI_UNCHECKED)
Next
EndSwitch
EndFunc
Func tab()
$tab = GUICtrlRead(@GUI_CtrlId)
Switch $tab
Case 0
For $i=1 to 4
$T="Checkbox"&$i
GUICtrlSetState(Eval($T),$GUI_CHECKED)
Next
Case 1
For $i=5 to 8
$T="Checkbox"&$i
GUICtrlSetState(Eval($T),$GUI_CHECKED)
Next
Case 2
For $i=9 to 12
$T="Checkbox"&$i
GUICtrlSetState(Eval($T),$GUI_CHECKED)
Next
EndSwitch
EndFunc