找回密码
 加入
搜索
查看: 2268|回复: 4

GUICtrlSetState设置控件状态的问题

  [复制链接]
发表于 2010-1-22 12:04:31 | 显示全部楼层 |阅读模式
比如 我现在界面中有  $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)  这样
发表于 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

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 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[3]
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 256, 171, 373, 202)
$ctrl[0] = GUICtrlCreateLabel("Label1", 24, 16, 180, 17)
$ctrl[1] = GUICtrlCreateLabel("Label2", 40, 40, 92, 17)
$ctrl[2] = 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

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

 楼主| 发表于 2010-1-22 19:30:21 | 显示全部楼层
先谢谢楼上二位 哥们  回头测试一下
发表于 2010-1-25 08:10:17 | 显示全部楼层
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 14:37 , Processed in 0.073888 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表