包括开始、停止、重置,共3个按钮
计时单位精确到0.01秒
重置后,再按开始是从0开始重新计时的
计时中会溢出错误?
请高手写一下代码,特别是重置后,我自己做的时候不能重新从0开始计时,而是又接着停止时的时间继续下去!!!
Option Explicit
--------------------------------------------------
Static iSec As Integer
Static iMin As Integer
Static iHour As Integer
--------------------------------------------------
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
--------------------------------------------------
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Command3_Click()
Timer1.Enabled = False
iSec = 0
iMin = 0
iHour = 0
End Sub
--------------------------------------------------
Private Sub Timer1_Timer()
iSec = iSec + 1
If iSec >= 60 Then
iMin = iMin + 1
iSec = 0
If iMin >= 60 Then
iHour = iHour + 1
iMin = 0
End If
End If
Label1.Caption = Format(iHour, "00") & ":" & _
Format(iMin, "00") & ":" & _
Format(iSec, "00")
End Sub