发布网友 发布时间:2022-05-17 00:15
共3个回答
热心网友 时间:2023-09-16 03:25
Private Sub Command1_Click()
If Command1.Caption = "&S 暂停" Then
Timer1.Enabled = False
Command1.Caption = "&C 继续"
Else
Command1.Caption = "&S 暂停"
If Label1.Caption = "00:00:00:0" Then
Form1.Tag = Timer
Timer1.Enabled = True
Else
Timer1.Enabled = True
End If
End If
End Sub
Private Sub Command2_Click()
Form1.Tag = Timer
Label1.Caption = "00:00:00:0"
End Sub
Private Sub Timer1_Timer()
m = Timer - Val(Form1.Tag)
n0 = (m * 10) Mod 10
m = Int(m)
n1 = Format(m Mod 60, "00:")
n2 = Format((m \ 60) Mod 60, "00:")
n3 = Format(m \ 3600, "00:")
Label1.Caption = n3 & n2 & n1 & n0
End Sub
热心网友 时间:2023-09-16 03:25
我帮你写吧。热心网友 时间:2023-09-16 03:26
liwei2012 正解,但是有个小问题,Timer是从午夜开始计时的,过了午夜应该会归零。所以不如直接记录当时时间Now比较好,然后通过DateDiff("s", , date1, date2)来得到时间间隔,另外暂停的那段时间应该给去掉。