vb编写2分钟倒计时的程序
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
这是FORM的代码
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3390
ClientLeft = 120
ClientTop = 450
ClientWidth = 4560
LinkTopic = "Form1"
ScaleHeight = 3390
ScaleWidth = 4560
StartUpPosition = 3 '窗口缺省
Begin mandButton Command1
Caption = "开始记时"
Height = 375
Left = 960
TabIndex = 1
Top = 2880
Width = 2655
End
Begin VB.Timer Timer1
Interval = 1000
Left = 120
Top = 2520
End
Begin bel Label4
Alignment = 2 'Center
BackColor = &H000000FF& Caption = "WARNING"
BeginProperty Font
Name = "宋体"
Size = 42
Charset = 134
Weight = 700
Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty
Height = 1095
Left = 960
TabIndex = 4
Top = 240
Width = 3255
End
Begin bel Label3
Alignment = 2 'Center
Caption = "00"
BeginProperty Font
Name = "宋体"
Size = 42
Charset = 134
Weight = 700
Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty
Height = 855
Left = 2760
TabIndex = 3
Top = 1800
Width = 1215
End
Begin bel Label2
Caption = ":"
BeginProperty Font
Name = "宋体"
Size = 42
Charset = 134
Weight = 700
Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty
Height = 1095
Left = 2280
TabIndex = 2
Top = 1680
Width = 375
End
Begin bel Label1
Alignment = 2 'Center
Caption = "2"
BeginProperty Font
Name = "宋体"
Size = 42
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 840
TabIndex = 0
Top = 1800
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Timer1.Enabled = True
Label4.Visible = False
Label1.Caption = 2
Label3.Caption = 0
End Sub
Private Sub Form_Load()
Dim x As Integer
Timer1.Enabled = False
Label4.Visible = False
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Timer1_Timer()
i = 1
Sum = Val(Label1.Caption) * 60 + Val(Label3.Caption) Sum = Sum - 1
If Sum >= 60 Then
Label1.Caption = 1
Label3.Caption = Sum - 60
ElseIf Sum < 60 Then
Label1.Caption = 0
Label3.Caption = Sum