檔案如果打不開,請調整 "相容性" ,(檔案右鍵 > 內容 > 相容性 > 使用相容性....)
如果你想要別人做好的碼表,可以參考這裡,碼表多到爆炸了:
http://win.softpedia.com/dyn-search.p...topwatch&x=0&y=0 複製程式
Option Explicit
Dim RecTi(2) As Integer, UpLimTi(2) As Integer
Dim RZNow As Boolean
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Or KeyCode = vbKeySpace Then
Label_Ti_Click
End If
End Sub
Private Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
End Sub
Private Sub Label_Ti_Click()
Dim i As Integer
'------ Check If Running ------
If Timer_Accumulate.Enabled Then
Timer_Accumulate.Enabled = False
Label_Ti.Caption = "00:00:00"
Exit Sub
End If
'------------------------------
'-------- RZ ---------
Label_Ti.Caption = "00:00:00"
For i = 0 To 2
RecTi(i) = 0
Next i
'RecTi(1) = 59: RecTi(0) = 56 '@@@ Only For Test
'RecTi(2) = 23: RecTi(1) = 59: RecTi(0) = 56 '@@@ Only For Test
UpLimTi(2) = 24: UpLimTi(1) = 60: UpLimTi(0) = 60
RZNow = True
Timer_Accumulate_Timer
RZNow = False
'---------------------
'----- Start Counting -----
Timer_Accumulate.Enabled = True
'--------------------------
End Sub
Private Sub Timer_Accumulate_Timer()
Static JustColon As Boolean
Dim i As Integer
If RZNow Then JustColon = False: Exit Sub
'------- Show The Time ------
Label_Ti.Caption = ShowTi(JustColon)
'----------------------------
JustColon = Not JustColon
End Sub
Public Function ShowTi(ByVal IfShowColon As Boolean) As String
Dim i As Integer
Dim TempAcc As Boolean, tempS As String
'--------- Accumulate ---------
If IfShowColon Then
RecTi(0) = RecTi(0) + 1
For i = 0 To UBound(RecTi())
RecTi(i) = RecTi(i) + IIf(TempAcc, 1, 0)
TempAcc = False
If RecTi(i) >= UpLimTi(i) Then RecTi(i) = 0: TempAcc = True
Next i
End If
'------------------------------
'-------- String & Return --------
For i = UBound(RecTi()) To 0 Step -1
tempS = tempS & Format(RecTi(i), String(Len(UpLimTi(i)), "0")) & IIf(i = 0, "", IIf(IfShowColon, ":", " "))
Next i
ShowTi = tempS
'--------------------------------
End Function