westmood 发表于 2015-6-22 17:41:25

新手问问题 radio

我有一张form, 里面有两个 radio1 和 radio2, 但我要怎 么表示选中 radio1 时要做A, 选中radio2 时要做B?

if 选中 radio1 then

A

endif

这个选中怎么表达?

ator916 发表于 2015-6-22 18:08:53

GUICtrlRead($radio1)
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
        Local $radio1, $radio2, $msg
        GUICreate("My GUI radio") ; will create a dialog box that when displayed is centered

        $radio1 = GUICtrlCreateRadio("Radio 1", 10, 10, 120, 20)
        $radio2 = GUICtrlCreateRadio("Radio 2", 10, 40, 120, 20)
        GUICtrlSetState($radio2, $GUI_CHECKED)

        GUISetState(@SW_SHOW) ; will display andialog box with 1 checkbox

        ; Run the GUI until the dialog is closed
        While 1
                $msg = GUIGetMsg()
                Select
                        Case $msg = $GUI_EVENT_CLOSE
                                ExitLoop
                        Case $msg = $radio1
                                If GUICtrlRead($radio1) = 1 Then
                                        MsgBox($MB_SYSTEMMODAL, 'Info:', 'You clicked the Radio 1 and it is Checked.')
                                EndIf
                        Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
                                MsgBox($MB_SYSTEMMODAL, 'Info:', 'You clicked on Radio 2 and it is Checked.')
                EndSelect
        WEnd
EndFunc   ;==>Example
页: [1]
查看完整版本: 新手问问题 radio