#include <GUIConstantsEx.au3>
GUICreate("选框测试", 300, 200)
Dim $Checkbox[4], $cb[4], $radio[4], $rd
$Checkbox[1] = GUICtrlCreateCheckbox("复选框1", 20, 20, 120, 20)
$Checkbox[2] = GUICtrlCreateCheckbox("复选框2", 20, 50)
$Checkbox[3] = GUICtrlCreateCheckbox("复选框3", 20, 80)
$radio[1] = GUICtrlCreateRadio("单选框1", 150, 20)
$radio[2] = GUICtrlCreateRadio("单选框2", 150, 50)
$radio[3] = GUICtrlCreateRadio("单选框3", 150, 80)
$Button = GUICtrlCreateButton('查看选择', 70, 130, 150, 25)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
For $i = 1 To 3
If BitAND(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then
$cb[$i] = '复选框 ' & $i & ' 已选中'
Else
$cb[$i] = '复选框 ' & $i & ' 未选中'
EndIf
Next
For $i = 1 To 3
If BitAND(GUICtrlRead($radio[$i]), $GUI_CHECKED) Then $rd = '单选框 ' & $i & ' 已选中'
Next
MsgBox(0, '状态:', $cb[1] & @CRLF & $cb[2] & @CRLF & $cb[3] & @CRLF & $rd)
EndSwitch
WEnd
http://www.autoitx.com/forum.php?mod=redirect&goto=findpost&ptid=9066&pid=77128&fromuid=7652121 |