|
本帖最后由 itqijian 于 2020-7-31 14:25 编辑 #include <Date.au3>
GUICreate('运行时间实时显示', 300, 100)
GUICtrlCreateLabel('本程序已运行:', 90, 70, 100, 15)
Dim $tl = GUICtrlCreateLabel('00天,00时,00分,00秒', 180, 70, 150, 15)
GUISetState()
Dim $timer = TimerInit(), $Day = 0
AdlibRegister('Timer', 500)
While 1
Switch GUIGetMsg()
Case -3
Exit
EndSwitch
WEnd
Func Timer()
Local $Secs, $Mins, $Hour, $Time, $ticks, $sTime
$ticks = Int(TimerDiff($timer)) * 5000 ;这里*5000是为了测试,将时间提速5000倍
If $ticks >= 86400000 Then
$Day += 1
$timer = TimerInit()
$ticks = 0
EndIf
_TicksToTime($ticks, $Hour, $Mins, $Secs)
$Time = StringFormat('%02s天,%02s时,%02s分,%02s秒', $Day, $Hour, $Mins, $Secs)
If $sTime <> $Time Then GUICtrlSetData($tl, $Time)
$sTime = $Time
EndFunc ;==>Timer
#include '_LabelProgress.au3'
$Form1 = GUICreate('反色文字Label进度条 @afan', 380, 80)
GUISetState()
$aProgress = _LabelProgress_Create(20, 20, 300, 30, ' 进度反色文字测试')
$i = 1
Do
Sleep(200)
$i += Random(0, 8, 1) ;随机进度增值
_LabelProgress_Set($Form1, $aProgress, $i)
Until $i >= 30
Sleep(1000)
_LabelProgress_Off($aProgress)
$aProgress = _LabelProgress_Create(20, 20, 300, 30, ' 进度反色文字测试')
$i =31
Do
Sleep(200)
$i += Random(0, 8, 1) ;随机进度增值
_LabelProgress_Set($Form1, $aProgress, $i)
Until $i >= 60
Sleep(1000)
_LabelProgress_Off($aProgress)
$aProgress = _LabelProgress_Create(20, 20, 300, 30, ' 进度反色文字测试')
$i =61
Do
Sleep(200)
$i += Random(0, 8, 1) ;随机进度增值
_LabelProgress_Set($Form1, $aProgress, $i)
Until $i >= 101
Sleep(1000)
_LabelProgress_Off($aProgress)
Exit
进度条的源码:https://www.autoitx.com/forum.php?mod=viewthread&tid=38023&highlight=%BD%F8%B6%C8%CC%F5
怎么在进度条里面添加计时(显示多少分多少秒) ?
|
|