heroxianf 发表于 2016-5-18 13:40:12

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

本帖最后由 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 = , $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

haijie1223 发表于 2016-5-18 20:24:06

加个判断就OK了Local $test = , $test1 = 9
Local $iExist = False
For $element In $test
        If $test1 = $element Then
                $iExist = True
                ExitLoop
        EndIf
Next

heroxianf 发表于 2016-5-19 08:44:35

回复 2# haijie1223


    谢谢海大 ,问题解决了。
页: [1]
查看完整版本: 如果通过判断条件是否满足现实或隐藏TAB控件[已解决]