|
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 139, 284, 193, 125)
$Checkbox1 = GUICtrlCreateCheckbox("注册1", 32, 24, 105, 33)
$Checkbox2 = GUICtrlCreateCheckbox("注册2", 32, 64, 105, 25)
$Checkbox3 = GUICtrlCreateCheckbox("注册3", 32, 104, 73, 17)
$Checkbox4 = GUICtrlCreateCheckbox("注册4", 32, 144, 89, 17)
$Button1 = GUICtrlCreateButton("全选", 16, 192, 97, 25, 0)
$Button2 = GUICtrlCreateButton("全不选", 16, 220, 97, 25, 0)
$Button3 = GUICtrlCreateButton("确定", 16, 249, 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 4
$T="Checkbox"&$i
GUICtrlSetState(Eval($T),$GUI_CHECKED)
Next
Case $Button2
For $i=1 to 4
$T="Checkbox"&$i
GUICtrlSetState(Eval($T),$GUI_UNCHECKED)
Next
Case $Button3
If $nMsg = $Button3 Then
GUISetState (@SW_HIDE )
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then MsgBox(64,"","你按下了CHECKBOX1")
If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then MsgBox(64,"","你按下了CHECKBOX2")
If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then MsgBox(0,"","你按下了CHKCKBOX3")
If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then MsgBox(0,"","你按下了CHKCKBOX4")
ExitLoop
EndIf
EndSwitch
WEnd
有没有更简单的方法写$Button3后的代码?
[ 本帖最后由 xg911335 于 2008-10-8 20:52 编辑 ] |
|