本帖最后由 afan 于 2010-12-14 18:04 编辑 GUICreate("Form1", 600, 450)
$Checkbox1 = GUICtrlCreateCheckbox("复选框 - 1", 40, 30, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("复选框 - 2", 160, 30, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("复选框 - 3", 280, 30, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("复选框 - 4", 400, 30, 97, 17)
$Checkbox5 = GUICtrlCreateCheckbox("复选框 - 5", 40, 80, 97, 17)
$Checkbox6 = GUICtrlCreateCheckbox("复选框 - 6", 160, 80, 97, 17)
$Checkbox7 = GUICtrlCreateCheckbox("复选框 - 7", 280, 80, 97, 17)
$Checkbox8 = GUICtrlCreateCheckbox("复选框 - 8", 400, 80, 97, 17)
$Checkbox9 = GUICtrlCreateCheckbox("复选框 - 9", 40, 130, 97, 17)
$Checkbox10 = GUICtrlCreateCheckbox("复选框 - 10", 160, 130, 97, 17)
$Checkbox11 = GUICtrlCreateCheckbox("复选框 - 11", 280, 130, 97, 17)
$Checkbox12 = GUICtrlCreateCheckbox("复选框 - 12", 400, 130, 97, 17)
$b = GUICtrlCreateButton('Start', 130, 200, 150, 25)
GUISetState()
$ck = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $b
For $i = 1 To 12
If GUICtrlRead(Eval('Checkbox' & $i)) = 1 Then
$ck = $i
Call('_Go')
EndIf
Next
EndSwitch
WEnd
Func _Go()
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
EndFunc ;==>_Go
实际应用:GUICreate("Form1", 600, 450)
$Checkbox1 = GUICtrlCreateCheckbox("复选框 - 1", 40, 30, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("复选框 - 2", 160, 30, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("复选框 - 3", 280, 30, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("复选框 - 4", 400, 30, 97, 17)
$Checkbox5 = GUICtrlCreateCheckbox("复选框 - 5", 40, 80, 97, 17)
$Checkbox6 = GUICtrlCreateCheckbox("复选框 - 6", 160, 80, 97, 17)
$Checkbox7 = GUICtrlCreateCheckbox("复选框 - 7", 280, 80, 97, 17)
$Checkbox8 = GUICtrlCreateCheckbox("复选框 - 8", 400, 80, 97, 17)
$Checkbox9 = GUICtrlCreateCheckbox("复选框 - 9", 40, 130, 97, 17)
$Checkbox10 = GUICtrlCreateCheckbox("复选框 - 10", 160, 130, 97, 17)
$Checkbox11 = GUICtrlCreateCheckbox("复选框 - 11", 280, 130, 97, 17)
$Checkbox12 = GUICtrlCreateCheckbox("复选框 - 12", 400, 130, 97, 17)
$b = GUICtrlCreateButton('Start', 130, 200, 150, 25)
GUISetState()
$ck = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $b
For $i = 1 To 12
If GUICtrlRead(Eval('Checkbox' & $i)) = 1 Then
$ck = $i
Call('_Go')
EndIf
Next
EndSwitch
WEnd
Func _Go()
Switch $ck
Case 1
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 2
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 3
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 4
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 5
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 6
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 7
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 8
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 9
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 10
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 11
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
Case 12
MsgBox(0, '', '执行复选框 ' & $ck & ' 的任务')
EndSwitch
EndFunc ;==>_Go
|