用数组也行啊,在创建控件时使用 数组 盛放变量#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
|