找回密码
 加入
搜索
查看: 1425|回复: 2

[AU3基础] 如果通过判断条件是否满足现实或隐藏TAB控件[已解决]

[复制链接]
发表于 2016-5-18 13:40:12 | 显示全部楼层 |阅读模式
本帖最后由 heroxianf 于 2016-5-19 08:44 编辑

下面是我测试的代码,我想通过$test的值与$test1进行对比,如果$test1包含在$test中就创建全部TAB控件,如果不包含就隐藏tab2。
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)

Local $test[5] = [1,2,3,4,5], $test1 = 9

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Tab1 = GUICtrlCreateTab(6, 72, 601, 361)

For $i = 0 To UBound($test) - 1
If $test[$i] = $test1 Then
        GUICtrlCreateTabItem("111")
        $Button1 = GUICtrlCreateButton("Button1", 264, 222, 75, 25)
        GUICtrlCreateTabItem("222")
        $Button2 = GUICtrlCreateButton("Button2", 264, 222, 75, 25)
        GUICtrlCreateTabItem("333")
        $Button3 = GUICtrlCreateButton("Button3", 264, 222, 75, 25)
ElseIf $test[$i] <> $test1 Then
        Sleep(10)
EndIf
Next
        GUICtrlCreateTabItem("111")
        $Button1 = GUICtrlCreateButton("Button1", 264, 222, 75, 25)
        GUICtrlCreateTabItem("333")
        $Button3 = GUICtrlCreateButton("Button3", 264, 222, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        Sleep(100)
WEnd

func Form1Close()
        Exit
EndFunc
发表于 2016-5-18 20:24:06 | 显示全部楼层
加个判断就OK了
Local $test[5] = [1, 2, 3, 4, 5], $test1 = 9
Local $iExist = False
For $element In $test
        If $test1 = $element Then
                $iExist = True
                ExitLoop
        EndIf
Next
 楼主| 发表于 2016-5-19 08:44:35 | 显示全部楼层
回复 2# haijie1223


    谢谢海大 ,问题解决了。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-19 08:11 , Processed in 0.090910 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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