回复 1# wgboy
无聊中,简单做个抽奖器。
非常非常的简陋。
#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
$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, 500, 40);,bitOr($SS_SUNKEN, $SS_CENTER,$TBSTYLE_EX_DOUBLEBUFFER))
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 16, 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), @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)
$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()
While 1
Sleep(10)
If Not $stop Then
GUICtrlSetData($lable3,$prize[Random(0,9,1)])
$temp=Random(0,UBound($ini)-1,1)
GUICtrlSetData($lable,$ini[$temp][1])
EndIf
WEnd
Func _start()
If GUICtrlRead($button1)='停止' Then
$stop=1
GUICtrlSetData($button1,'开始')
_ArrayDelete($ini,$temp)
GUICtrlSetData($lable2,"剩余抽奖人数:"&UBound($ini))
Else
$stop=0
GUICtrlSetData($button1,'停止')
EndIf
EndFunc
Func _exit()
Exit
EndFunc
|