函数参考


_GUICtrlButton_Enable

应用或者禁用鼠标和键盘对指定按钮的输入

#include <GuiButton.au3>
_GUICtrlButton_Enable($hWnd [, $fEnable = True])

参数

$hWnd 控件的控件ID/句柄
$fEnable [可选参数] 指定启用或禁用:
 True - 启用
False - 禁用

返回值

成功: 返回 True
失败: 返回 False

注意/说明

None.

相关

示例/演示


#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
    Local $rdo, $rdo2, $chk

    GUICreate("Buttons", 400, 400)
    $iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

    $rdo = GUICtrlCreateRadio("Radio1", 10, 10, 90, 50)

    $rdo2 = GUICtrlCreateRadio("Radio2", 10, 60, 90, 50)
    _GUICtrlButton_SetCheck($rdo2)

    $chk = GUICtrlCreateCheckbox("Check1", 10, 120, 90, 50, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
    _GUICtrlButton_SetCheck($chk, $BST_INDETERMINATE)

    GUISetState()

    MemoWrite("Disabled Button: " & _GUICtrlButton_Enable($rdo2, False))
    Sleep(1000)
    MemoWrite("Enabled Button: " & _GUICtrlButton_Enable($rdo2))

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $rdo
                MemoWrite("Clicked $rdo")
            Case $rdo2
                MemoWrite("Clicked $rdo2")
            Case $chk
                MemoWrite("Clicked $chk")
        EndSwitch
    WEnd

    Exit
EndFunc   ;==>_Main

; 写入一行到 memo 控件
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite