这是lynfr8前辈写的,稍做改动就能实现你的目的。#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 139, 254, 193, 125)
$Checkbox1 = GUICtrlCreateCheckbox("注册1", 32, 24, 105, 33)
$Checkbox2 = GUICtrlCreateCheckbox("注册3", 32, 104, 73, 17)
$Button1 = GUICtrlCreateButton("全选", 16, 192, 97, 25, 0)
$Button2 = GUICtrlCreateButton("判断", 16, 220, 97, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
For $i=1 to 2
$T="Checkbox"&$i
GUICtrlSetState(Eval($T),$GUI_CHECKED)
Next
Case $Button2
For $i=1 to 2
$T="Checkbox"&$i
If GUICtrlRead(Eval($T))=$GUI_UNCHECKED Then MsgBox(0,0,$T&'没选择')
If GUICtrlRead(Eval($T))=$GUI_CHECKED Then MsgBox(0,0,$T&'已选择')
Next
EndSwitch
WEnd
|