当前位置:文档之家› vb编写2分钟倒计时的程序

vb编写2分钟倒计时的程序

vb编写2分钟倒计时的程序
vb编写2分钟倒计时的程序

这是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 https://www.doczj.com/doc/0b16941192.html,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 https://www.doczj.com/doc/0b16941192.html,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 https://www.doczj.com/doc/0b16941192.html,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 https://www.doczj.com/doc/0b16941192.html,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 https://www.doczj.com/doc/0b16941192.html,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

If Sum <= 10 And Sum Mod 2 = 0 Then Beep

Label4.Visible = True

Else

Label4.Visible = False

End If

End If

If Sum = 0 Then

Timer1.Enabled = False

End If

End Sub

下面是对象的编辑

相关主题
文本预览
相关文档 最新文档