本帖最后由 yarsye 于 2010-7-26 16:14 编辑
我想实现的是 建立3个checkbox 让用户选 然后 判断用户选了哪几个
例如 选择1,3checkbox 然后点ok ,1,3下面的函数应该执行
想法有 但是不知道怎么实现
有太多东西部会 让人着实着急了一把
感谢你的阅读 盼望高手解答#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Global $box1, $msg ,$ok,$button1,$box2,$checked,$i,$box3,$ch,$chked
$ch= 0
GUICreate("My GUI Checkbox")
$box1 = GUICtrlCreateCheckbox("box1", 10, 10, 120, 20)
$box2 = GUICtrlCreateCheckbox("box2",10,30,120,20)
$box3 = GUICtrlCreateCheckbox("box3", 10, 50, 120 ,20)
$button1=GUICtrlCreateButton("button1",120,120,120,20)
GUISetState()
GUICtrlSetOnEvent($button1,"ok")
;GUICtrlSetOnEvent($box1,"func1")
For $i = 1 To 2
If GUICtrlRead (Eval("$chkbox"&$i)) = $GUI_CHECKED Then
$ch = $ch + BitShift (1,1-$i )
EndIf
Next
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Func ok()
For $i = 1 To 2
Execute ("func"&$i&"("&$ch&")")
Next
EndFunc
Func func1($ch)
If BitAND($ch,1) = 0 Then
MsgBox(0,$ch,"2")
Return
EndIf
EndFunc
Func func2($ch)
If BitAND($ch,2) = 0 Then
MsgBox(0,$ch,"3")
Return
EndIf
EndFunc
Func func3($ch)
If BitAND($ch,5) = 0 Then
MsgBox(0,$ch,"4")
Return
EndIf
EndFunc
|