跪求 vb多功能计时器代码 要有时钟 秒表 和倒计时的功能,秒表有暂停,开始功能的
发布网友
发布时间:2022-05-07 18:45
我来回答
共2个回答
热心网友
时间:2023-11-08 04:54
简单的么,用timer控件做,精确些的么用,timer函数做.
时钟和倒计时很简单的了自己做一下
下面是 一个秒表程序,command 3个,label 1个.
Option Explicit
Dim PP As Boolean
Dim SS As Boolean
Dim TT As Single
Private Sub Command1_Click() '开始
TT = 0
PP = False
SS = False
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command2.Caption = "暂停"
tmr
End Sub
Private Sub tmr() '秒表
Dim t As Single
t = Timer
Do
showTT Timer - t + TT
DoEvents
Loop Until SS Or PP
TT = Timer - t + TT
End Sub
Private Sub showTT(ByVal t As Single)
Dim h As Integer
Dim s As String
h = Int(t / 3600)
t = t - h * 3600
s = h & ":"
h = Int(t / 60)
s = s & Format(h, "00") & ":"
t = t - h * 60
h = Int(t)
s = s & Format(h, "00") & "."
t = Int((t - h) * 100)
s = s & t
Label1.Caption = s
End Sub
Private Sub Command2_Click() '暂停和继续
PP = Not PP
Command2.Caption = IIf(PP, "继续", "暂停")
If Not PP Then tmr
End Sub
Private Sub Command3_Click()
SS = True
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub追问还要求液晶数字的
来自:求助得到的回答
热心网友
时间:2023-11-08 04:54
简单的么,用timer控件做,精确些的么用,timer函数做.
时钟和倒计时很简单的了自己做一下
下面是 一个秒表程序,command 3个,label 1个.
Option Explicit
Dim PP As Boolean
Dim SS As Boolean
Dim TT As Single
Private Sub Command1_Click() '开始
TT = 0
PP = False
SS = False
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command2.Caption = "暂停"
tmr
End Sub
Private Sub tmr() '秒表
Dim t As Single
t = Timer
Do
showTT Timer - t + TT
DoEvents
Loop Until SS Or PP
TT = Timer - t + TT
End Sub
Private Sub showTT(ByVal t As Single)
Dim h As Integer
Dim s As String
h = Int(t / 3600)
t = t - h * 3600
s = h & ":"
h = Int(t / 60)
s = s & Format(h, "00") & ":"
t = t - h * 60
h = Int(t)
s = s & Format(h, "00") & "."
t = Int((t - h) * 100)
s = s & t
Label1.Caption = s
End Sub
Private Sub Command2_Click() '暂停和继续
PP = Not PP
Command2.Caption = IIf(PP, "继续", "暂停")
If Not PP Then tmr
End Sub
Private Sub Command3_Click()
SS = True
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub追问还要求液晶数字的
来自:求助得到的回答
热心网友
时间:2023-11-08 04:54
简单的么,用timer控件做,精确些的么用,timer函数做.
时钟和倒计时很简单的了自己做一下
下面是 一个秒表程序,command 3个,label 1个.
Option Explicit
Dim PP As Boolean
Dim SS As Boolean
Dim TT As Single
Private Sub Command1_Click() '开始
TT = 0
PP = False
SS = False
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command2.Caption = "暂停"
tmr
End Sub
Private Sub tmr() '秒表
Dim t As Single
t = Timer
Do
showTT Timer - t + TT
DoEvents
Loop Until SS Or PP
TT = Timer - t + TT
End Sub
Private Sub showTT(ByVal t As Single)
Dim h As Integer
Dim s As String
h = Int(t / 3600)
t = t - h * 3600
s = h & ":"
h = Int(t / 60)
s = s & Format(h, "00") & ":"
t = t - h * 60
h = Int(t)
s = s & Format(h, "00") & "."
t = Int((t - h) * 100)
s = s & t
Label1.Caption = s
End Sub
Private Sub Command2_Click() '暂停和继续
PP = Not PP
Command2.Caption = IIf(PP, "继续", "暂停")
If Not PP Then tmr
End Sub
Private Sub Command3_Click()
SS = True
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub追问还要求液晶数字的
来自:求助得到的回答
热心网友
时间:2023-11-08 04:55
把300改为5,省时间
Dim n1 As Integer
Dim n2 As Integer
Private Sub Command1_Click()
Timer1.Interval = 1000
n1 = 300
n1 = n1 - n2
n2 = n2 + 1
Label1.Caption = Str(n1)
If n1 = 0 Then
Timer1.Enabled = True
n1 = 300: n2 = 0
End If
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 1000
n1 = 300
n2 = n2 + 1
n1 = n1 - n2
Label1.Caption = Str(n1)
If n1 = 0 Then
Call Command1_Click
End If
End Sub
热心网友
时间:2023-11-08 04:54
简单的么,用timer控件做,精确些的么用,timer函数做.
时钟和倒计时很简单的了自己做一下
下面是 一个秒表程序,command 3个,label 1个.
Option Explicit
Dim PP As Boolean
Dim SS As Boolean
Dim TT As Single
Private Sub Command1_Click() '开始
TT = 0
PP = False
SS = False
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command2.Caption = "暂停"
tmr
End Sub
Private Sub tmr() '秒表
Dim t As Single
t = Timer
Do
showTT Timer - t + TT
DoEvents
Loop Until SS Or PP
TT = Timer - t + TT
End Sub
Private Sub showTT(ByVal t As Single)
Dim h As Integer
Dim s As String
h = Int(t / 3600)
t = t - h * 3600
s = h & ":"
h = Int(t / 60)
s = s & Format(h, "00") & ":"
t = t - h * 60
h = Int(t)
s = s & Format(h, "00") & "."
t = Int((t - h) * 100)
s = s & t
Label1.Caption = s
End Sub
Private Sub Command2_Click() '暂停和继续
PP = Not PP
Command2.Caption = IIf(PP, "继续", "暂停")
If Not PP Then tmr
End Sub
Private Sub Command3_Click()
SS = True
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub追问还要求液晶数字的
来自:求助得到的回答
热心网友
时间:2023-11-08 04:55
把300改为5,省时间
Dim n1 As Integer
Dim n2 As Integer
Private Sub Command1_Click()
Timer1.Interval = 1000
n1 = 300
n1 = n1 - n2
n2 = n2 + 1
Label1.Caption = Str(n1)
If n1 = 0 Then
Timer1.Enabled = True
n1 = 300: n2 = 0
End If
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 1000
n1 = 300
n2 = n2 + 1
n1 = n1 - n2
Label1.Caption = Str(n1)
If n1 = 0 Then
Call Command1_Click
End If
End Sub
热心网友
时间:2023-11-08 04:55
把300改为5,省时间
Dim n1 As Integer
Dim n2 As Integer
Private Sub Command1_Click()
Timer1.Interval = 1000
n1 = 300
n1 = n1 - n2
n2 = n2 + 1
Label1.Caption = Str(n1)
If n1 = 0 Then
Timer1.Enabled = True
n1 = 300: n2 = 0
End If
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 1000
n1 = 300
n2 = n2 + 1
n1 = n1 - n2
Label1.Caption = Str(n1)
If n1 = 0 Then
Call Command1_Click
End If
End Sub
热心网友
时间:2023-11-08 04:54
简单的么,用timer控件做,精确些的么用,timer函数做.
时钟和倒计时很简单的了自己做一下
下面是 一个秒表程序,command 3个,label 1个.
Option Explicit
Dim PP As Boolean
Dim SS As Boolean
Dim TT As Single
Private Sub Command1_Click() '开始
TT = 0
PP = False
SS = False
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command2.Caption = "暂停"
tmr
End Sub
Private Sub tmr() '秒表
Dim t As Single
t = Timer
Do
showTT Timer - t + TT
DoEvents
Loop Until SS Or PP
TT = Timer - t + TT
End Sub
Private Sub showTT(ByVal t As Single)
Dim h As Integer
Dim s As String
h = Int(t / 3600)
t = t - h * 3600
s = h & ":"
h = Int(t / 60)
s = s & Format(h, "00") & ":"
t = t - h * 60
h = Int(t)
s = s & Format(h, "00") & "."
t = Int((t - h) * 100)
s = s & t
Label1.Caption = s
End Sub
Private Sub Command2_Click() '暂停和继续
PP = Not PP
Command2.Caption = IIf(PP, "继续", "暂停")
If Not PP Then tmr
End Sub
Private Sub Command3_Click()
SS = True
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub追问还要求液晶数字的
来自:求助得到的回答
热心网友
时间:2023-11-08 04:55
把300改为5,省时间
Dim n1 As Integer
Dim n2 As Integer
Private Sub Command1_Click()
Timer1.Interval = 1000
n1 = 300
n1 = n1 - n2
n2 = n2 + 1
Label1.Caption = Str(n1)
If n1 = 0 Then
Timer1.Enabled = True
n1 = 300: n2 = 0
End If
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 1000
n1 = 300
n2 = n2 + 1
n1 = n1 - n2
Label1.Caption = Str(n1)
If n1 = 0 Then
Call Command1_Click
End If
End Sub
热心网友
时间:2023-11-08 04:55
把300改为5,省时间
Dim n1 As Integer
Dim n2 As Integer
Private Sub Command1_Click()
Timer1.Interval = 1000
n1 = 300
n1 = n1 - n2
n2 = n2 + 1
Label1.Caption = Str(n1)
If n1 = 0 Then
Timer1.Enabled = True
n1 = 300: n2 = 0
End If
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 1000
n1 = 300
n2 = n2 + 1
n1 = n1 - n2
Label1.Caption = Str(n1)
If n1 = 0 Then
Call Command1_Click
End If
End Sub
热心网友
时间:2023-11-30 05:52
简单的么,用timer控件做,精确些的么用,timer函数做.
时钟和倒计时很简单的了自己做一下
下面是 一个秒表程序,command 3个,label 1个.
Option Explicit
Dim PP As Boolean
Dim SS As Boolean
Dim TT As Single
Private Sub Command1_Click() '开始
TT = 0
PP = False
SS = False
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command2.Caption = "暂停"
tmr
End Sub
Private Sub tmr() '秒表
Dim t As Single
t = Timer
Do
showTT Timer - t + TT
DoEvents
Loop Until SS Or PP
TT = Timer - t + TT
End Sub
Private Sub showTT(ByVal t As Single)
Dim h As Integer
Dim s As String
h = Int(t / 3600)
t = t - h * 3600
s = h & ":"
h = Int(t / 60)
s = s & Format(h, "00") & ":"
t = t - h * 60
h = Int(t)
s = s & Format(h, "00") & "."
t = Int((t - h) * 100)
s = s & t
Label1.Caption = s
End Sub
Private Sub Command2_Click() '暂停和继续
PP = Not PP
Command2.Caption = IIf(PP, "继续", "暂停")
If Not PP Then tmr
End Sub
Private Sub Command3_Click()
SS = True
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub追问还要求液晶数字的
来自:求助得到的回答
热心网友
时间:2023-11-30 05:53
把300改为5,省时间
Dim n1 As Integer
Dim n2 As Integer
Private Sub Command1_Click()
Timer1.Interval = 1000
n1 = 300
n1 = n1 - n2
n2 = n2 + 1
Label1.Caption = Str(n1)
If n1 = 0 Then
Timer1.Enabled = True
n1 = 300: n2 = 0
End If
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 1000
n1 = 300
n2 = n2 + 1
n1 = n1 - n2
Label1.Caption = Str(n1)
If n1 = 0 Then
Call Command1_Click
End If
End Sub
热心网友
时间:2023-11-08 04:55
简单的么,用timer控件做,精确些的么用,timer函数做.
时钟和倒计时很简单的了自己做一下
下面是 一个秒表程序,command 3个,label 1个.
Option Explicit
Dim PP As Boolean
Dim SS As Boolean
Dim TT As Single
Private Sub Command1_Click() '开始
TT = 0
PP = False
SS = False
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command2.Caption = "暂停"
tmr
End Sub
Private Sub tmr() '秒表
Dim t As Single
t = Timer
Do
showTT Timer - t + TT
DoEvents
Loop Until SS Or PP
TT = Timer - t + TT
End Sub
Private Sub showTT(ByVal t As Single)
Dim h As Integer
Dim s As String
h = Int(t / 3600)
t = t - h * 3600
s = h & ":"
h = Int(t / 60)
s = s & Format(h, "00") & ":"
t = t - h * 60
h = Int(t)
s = s & Format(h, "00") & "."
t = Int((t - h) * 100)
s = s & t
Label1.Caption = s
End Sub
Private Sub Command2_Click() '暂停和继续
PP = Not PP
Command2.Caption = IIf(PP, "继续", "暂停")
If Not PP Then tmr
End Sub
Private Sub Command3_Click()
SS = True
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub追问还要求液晶数字的
来自:求助得到的回答
热心网友
时间:2023-11-08 04:55
把300改为5,省时间
Dim n1 As Integer
Dim n2 As Integer
Private Sub Command1_Click()
Timer1.Interval = 1000
n1 = 300
n1 = n1 - n2
n2 = n2 + 1
Label1.Caption = Str(n1)
If n1 = 0 Then
Timer1.Enabled = True
n1 = 300: n2 = 0
End If
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 1000
n1 = 300
n2 = n2 + 1
n1 = n1 - n2
Label1.Caption = Str(n1)
If n1 = 0 Then
Call Command1_Click
End If
End Sub