vb 十分钟倒计时源码
发布网友
发布时间:2023-01-08 15:00
我来回答
共1个回答
热心网友
时间:2023-09-25 15:14
窗体上画一个按钮,一个标签,一个timer
Dim
i
As
Long
Private
Sub
Command1_Click()
Timer1.Enabled
=
True
End
Sub
Private
Sub
Form_Load()
Timer1.Interval
=
1000
Timer1.Enabled
=
False
Command1.Caption
=
"开始倒计时"
Label1.Caption
=
"请点击按钮开始"
Label1.AutoSize
=
True
i
=
600
End
Sub
Private
Sub
Timer1_Timer()
i
=
i
-
1
Label1.Caption
=
"倒计时"
&
Int(i
/
60)
&
"分"
&
i
Mod
60
&
"秒"
If
i
=
0
Then
MsgBox
"时间到!",
vbInformation:
Timer1.Enabled
=
False
End
Sub