Dim x As Long Dim h As Long, m As Long, s As Long, ms As Long Dim cjlh As Long, cjlm As Long, cjls As Long Dim cjlms As String Private Sub Form_L) 'Form1.StartUpPosition = 2 Form1.Caption = "真正的动态秒表(小时:分:秒.毫秒)" Command1.Caption = "开始[&S]" Command2.Caption = "结束[&E]" Label1.Alignment = 2 '居中对齐 Label1.Caption = "00:00:00.000" Timer1.Interval = 10 Timer1.Enabled = False Label1.BackColor = &H0& Label1.ForeColor = &HFF00& Label1.Font.Name = "Arial Rounded MT Bold" Label1.Alignment = 2 x = 0 End Sub Private Sub Command1_Click() Timer1.Enabled = True Label1.Font.Size = 24 End Sub Private Sub Command2_Click() Timer1.Enabled = False Label1.Font.Size = 14 x = 0 Label1.Caption = "运行了" & IIf(Len(Trim(Str(h))) < 2, "0" & Trim(Str(h)), Trim(Str(h))) & "小时" & IIf(Len(Trim(Str(m))) < 2, "0" & Trim(Str(m)), Trim(Str(m))) & "分" & IIf(Len(Trim(Str(s))) < 2, "0" & Trim(Str(s)), Trim(Str(s))) & "秒" & cjlms & "毫秒" Form1.Caption = Label1.Caption End Sub Private Sub Timer1_Timer() '每1秒钟触发100次 x = x + 10 '单位是毫秒 cjlh = Int(x / 3600000) h = cjlh '取得小时 cjlm = Int(((x Mod 3600000) / 60000)) '关键在这里,用INT取整,不用INT的话,每30秒进1,有点奇怪 m = cjlm '取得分钟 cjls = Int(((x Mod 3600000) Mod 60000) / 1000) s = cjls '取得秒种 ms = (((x Mod 3600000) Mod 60000) Mod 1000) If Len(Trim(Str(ms))) = 2 Then cjlms = "0" & Trim(Str(ms)) End If If Len(Trim(Str(ms))) >= 3 Then cjlms = Trim(Str(ms)) End If cjlms = Left(cjlms, 2) & Trim(Str(Int(Rnd * 9))) Label1.Caption = IIf(Len(Trim(Str(h))) < 2, "0" & Trim(S 手机支付宝搜索P2zPYPB74GJ即可领取作者发的红包,赶快参与吧!