frmMain(frmMain.frm)窗体:有两个Timer控件
Private Sub tmr790Blink_Timer()
End Sub
Private Sub tmrUpdateTime_Timer()
Dim Elapsed As Long
Dim nHours As Long, nMinutes As Long, nSeconds As Long
Dim strH As String, strMin As String, strSec As String
Dim strTimeStatus As String
Dim MaxLen As Byte
Info.ThisTime = GetTickCount
Elapsed = (Info.ThisTime - Info.StartTime)
nHours = Elapsed \ 3600000
Elapsed = Elapsed - (nHours * 3600000)
nMinutes = Elapsed \ 60000
Elapsed = Elapsed - (nMinutes * 60000)
nSeconds = Elapsed \ 1000
strH = "": strMin = ""
If nHours > 0 Then strH = Trim(Str(nHours)) & " h "
If nMinutes > 0 Or nHours > 0 Then strMin = Trim(Str(nMinutes)) & " m "
strSec = Trim(Str(nSeconds)) & " 秒 "
strH = Space$((3 + 3) - Len(strH)) & strH
strMin = Space$((2 + 3) - Len(strMin)) & strMin
strSec = Space$((2 + 3) - Len(strSec)) & strSec
strTimeStatus = strH & strMin & strSec
MaxLen = (3 + 3) + (2 + 3) + (2 + 3)
strTimeStatus = Space$(MaxLen - Len(strTimeStatus)) & strTimeStatus
frmMain.Status.Panels(2).Text = strTimeStatus
End Sub
Private Sub tmrUpdateTime_Timer()
Dim Elapsed As Long
Dim nHours As Long, nMinutes As Long, nSeconds As Long
Dim strH As String, strMin As String, strSec As String
Dim strTimeStatus As String
Dim MaxLen As Byte
Info.ThisTime = GetTickCount
Elapsed = (Info.ThisTime - Info.StartTime)
nHours = Elapsed \ 3600000
Elapsed = Elapsed - (nHours * 3600000)
nMinutes = Elapsed \ 60000
Elapsed = Elapsed - (nMinutes * 60000)
nSeconds = Elapsed \ 1000
strH = "": strMin = ""
If nHours > 0 Then strH = Trim(Str(nHours)) & " h "
If nMinutes > 0 Or nHours > 0 Then strMin = Trim(Str(nMinutes)) & " m "
strSec = Trim(Str(nSeconds)) & " 秒 "
strH = Space$((3 + 3) - Len(strH)) & strH
strMin = Space$((2 + 3) - Len(strMin)) & strMin
strSec = Space$((2 + 3) - Len(strSec)) & strSec
strTimeStatus = strH & strMin & strSec
MaxLen = (3 + 3) + (2 + 3) + (2 + 3)
strTimeStatus = Space$(MaxLen - Len(strTimeStatus)) & strTimeStatus
frmMain.Status.Panels(2).Text = strTimeStatus
End Sub