#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Local $nLabel[10] ;定义Label数量
$Form1 = GUICreate("Form1", 523, 294, 221, 130)
$Button1 = GUICtrlCreateButton("按钮1", 248, 232, 97, 33)
$Button2 = GUICtrlCreateButton("按钮2", 372, 232, 97, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
CL(10)
Case $Button2
RL(10)
CL(5)
EndSwitch
WEnd
Func CL($Val) ;建立Label(数量)
For $i=0 to $Val-1
$nLabel[$i] = GUICtrlCreateLabel("Label"&$i, 40, 32*$i, 36, 17)
Next
EndFunc
Func RL($Val) ;清除Label(数量)
For $i=0 to $Val-1
GUICtrlDelete ( $nLabel[$i] )
Next
EndFunc
|