发个基本没什么用的代码[简单代码实现的计时/倒计时]
本帖最后由 netegg 于 2011-10-26 16:36 编辑重新编辑了下,精简了些#NoTrayIcon
#include <WindowsConstants.au3>
HotKeySet('{esc}', 'exitau3')
GUICreate("", 178, 108, 400, 268, BitOR($DS_MODALFRAME, $WS_POPUPWINDOW))
$time = GUICtrlCreateLabel("00:59:50 ", 24, 12, 240, 40)
GUICtrlSetFont(-1, 50, 400, 0, "MS Sans Serif")
$timer = GUICtrlCreateLabel("01:00:10 ", 24, 56, 210, 40)
GUICtrlSetFont(-1, 50, 400, 0, "MS Sans Serif")
AdlibRegister('timer')
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func exitau3()
AdlibUnRegister('timer')
Exit
EndFunc ;==>exitau3
Func timer()
While 1
$k = Number(StringLeft(GUICtrlRead($time), 2))
$i = Number(StringMid(GUICtrlRead($time), 4, 2))
$j = Number(StringRight(StringTrimRight(GUICtrlRead($time), 1), 2))
$l = Number(StringLeft(GUICtrlRead($timer), 2))
$m = Number(StringMid(GUICtrlRead($timer), 4, 2))
$n = Number(StringRight(StringTrimRight(GUICtrlRead($timer), 1), 2))
; 计时
If $j <> 59 Then
$j += 1
Else
$j = 0
If $i < 59 Then
$i += 1
Else
$i = 0
If $k < 23 Then
$k += 1
Else
$k = 0
EndIf
EndIf
EndIf
;倒计时
If $n > 0 Then
$n -= 1
Else
$n = 59
If $m <> 0 Then
$m -= 1
Else
$m = 59
If $l <> 0 Then
$l -= 1
Else
$l = 23
EndIf
EndIf
EndIf
GUICtrlSetData($time, StringFormat("%02d:%02d:%02d\n", $k, $i, $j))
GUICtrlSetData($timer, StringFormat("%02d:%02d:%02d\n", $l, $m, $n))
Sleep(1000)
WEnd
EndFunc ;==>timer
你怎么会觉得没用呢? 这个没办法退出倒计时啊。。。不好用 不错啊,写得不错啊 运行出错了 回复 3# wangqinpei
不明白你什么意思 我们只是路人 顶你一个。。。。
null
留名记录……… 应该蛮有用的,就是得好好研究它。
页:
[1]