非典男人 发表于 2010-1-22 12:04:31

GUICtrlSetState设置控件状态的问题

比如 我现在界面中有$a= "test001"$b= "test002" $c= "test003"
我现在隐藏这些的时候用
        GUICtrlSetState($a, $GUI_HIDE)
                GUICtrlSetState($a, $GUI_HIDE)
                GUICtrlSetState($a, $GUI_HIDE)

请问有没有办法在一个GUICtrlSetState(-1, $GUI_HIDE) 里面实现隐藏
比如GUICtrlSetState($a,$b,$c,   $GUI_HIDE)这样

gapkiller 发表于 2010-1-22 14:31:36

未验证..Func _GuiCtrlSetState( $state, $c1=0, $c2=0, $c3=0, $c4=0, $c5=0, $c6=0, $c7=0, $c8=0, $c9=0 )
        For $i=1 To @NumParams-1
                GUICtrlSetState(Eval("c"&$i),$state)
        Next
EndFunc

maxkingmax 发表于 2010-1-22 16:17:44

用数组也行啊,在创建控件时使用 数组 盛放变量#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Local $ctrl
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 256, 171, 373, 202)
$ctrl = GUICtrlCreateLabel("Label1", 24, 16, 180, 17)
$ctrl = GUICtrlCreateLabel("Label2", 40, 40, 92, 17)
$ctrl = GUICtrlCreateInput("Input1", 8, 64, 121, 21)

$Button1 = GUICtrlCreateButton("显示", 32, 120, 75, 25)
$Button2 = GUICtrlCreateButton("隐藏", 152, 120, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        For $i=0 To UBound($ctrl)-1
                        GUICtrlSetState($ctrl[$I],$GUI_SHOW)
                        Next
                       
                Case $Button2
                        For $i=0 To UBound($ctrl)-1
                        GUICtrlSetState($ctrl[$I],$GUI_HIDE)
                        Next
        EndSwitch
WEnd

非典男人 发表于 2010-1-22 19:30:21

先谢谢楼上二位 哥们回头测试一下

才星清 发表于 2010-1-25 08:10:17

顶顶!!!
























页: [1]
查看完整版本: GUICtrlSetState设置控件状态的问题