给你稍微改了下~~~~
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GuiToolBar.au3>
#include <array.au3>
Opt("GUIOnEventMode", 1)
Global $gui, $guiPos, $pic, $picPos
Local $n, $msg
Local $Prize[10] = ["10000元", "5000元", "2000元", "1000元", "500元", "400元", "300元", "200元", "100元", "50元"]
Local $ini = IniReadSection("test.ini", "name")
Global $stop = 1, $temp
Dim $label_arr[15]
$form1 = GUICreate("My GUI picture", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetBkColor(0xE0FFFF)
$n = GUICtrlCreatePic(@ScriptDir & "\狂欢.jpg", 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetState(-1, $gui_disable)
$lable = GUICtrlCreateLabel("年终抽奖", @DesktopWidth / 16 * 8 - 100, @DesktopHeight / 10 * 5 - 100, 300, 80);,bitOr($SS_SUNKEN, $SS_CENTER,$TBSTYLE_EX_DOUBLEBUFFER))
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 40, 800, Default, '黑体')
GUICtrlSetColor(-1, 0xffffff)
$lable3 = GUICtrlCreateLabel("名单", @DesktopWidth / 16 * 8 - 100, @DesktopHeight / 10 * 7 - 100, 200, 40);,bitOr($SS_SUNKEN, $SS_CENTER,$TBSTYLE_EX_DOUBLEBUFFER))
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 24, 800, Default, '黑体')
GUICtrlSetColor(-1, 0xffffff)
$lable1 = GUICtrlCreateLabel("抽奖参与人数:" & (UBound($ini)-1), @DesktopWidth / 16 * 1, @DesktopHeight / 10 * 1, 100, 200)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 12, 800, Default, '黑体')
GUICtrlSetColor(-1, 0xffffff)
$lable2 = GUICtrlCreateLabel("已抽奖人数:", @DesktopWidth / 16 * 12, @DesktopHeight / 10 * 1, 200, 40)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 12, 800, Default, '黑体')
GUICtrlSetColor(-1, 0xffffff)
For $i = 1 To 10
$label_arr[$i] = GUICtrlCreateLabel("1", @DesktopWidth / 16 * 12, @DesktopHeight / 10 * 2 + 40 * $i, 200, 40)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 24, 800, Default, '黑体')
GUICtrlSetColor(-1, 0xffffff)
Next
$button1 = GUICtrlCreateButton("开始", @DesktopWidth / 16 * 5, @DesktopHeight / 10 * 8, 80, 40)
GUICtrlSetOnEvent(-1, '_start')
$button2 = GUICtrlCreateButton("退出", @DesktopWidth / 16 * 9, @DesktopHeight / 10 * 8, 80, 40)
GUICtrlSetOnEvent(-1, '_exit')
GUISetState()
$i = 1 ;记录数组键值
While 1
Sleep(10)
If Not $stop Then
GUICtrlSetData($lable3, $prize[$i-1])
If UBound($ini)-1 = 1 Then
$temp = 1
Else
$temp = Random(1, UBound($ini) - 1, 1)
EndIf
GUICtrlSetData($label_arr[$i], $ini[$temp][1])
If $ini[$temp][1] = "" Then MsgBox(0,0,UBound($ini) - 1)
IniWrite("w.ini", "zj", $i, $ini[$temp][1])
EndIf
WEnd
Func _start()
If GUICtrlRead($button1) = '停止' Then
$stop = 1
GUICtrlSetData($button1, '开始')
$i = $i + 1 ;数组记录
_ArrayDelete($ini, $temp)
GUICtrlSetData($lable2, "剩余抽奖人数:" & UBound($ini) - 1)
Else
If $i >= 11 Then
GUICtrlSetData($lable,"抽奖完成")
return
EndIf
$stop = 0
GUICtrlSetData($button1, '停止')
EndIf
EndFunc ;==>_start
Func _exit()
Exit
EndFunc ;==>_exit
|