??
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "電子倒計時器"
ClientHeight = 2310
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 2310
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Interval = 1000
Left = 3840
Top = 720
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 0
Top = 600
Width = 495
End
Begin VB.CommandButton Command1
Caption = "倒計時"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 4
Top = 1425
Width = 975
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2280
TabIndex = 3
Top = 600
Width = 495
End
Begin VB.Label Label3
Caption = "秒"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2400
TabIndex = 2
Top = 240
Width = 375
End
Begin VB.Label Label2
Caption = "分鐘"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1200
TabIndex = 1
Top = 240
Width = 495
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim m As Integer, s As Integer '聲明模塊級變量
Private Sub Form_Load()
Timer1.Interval = 1000 '設置每隔1秒觸發1次Timer事件
Timer1.Enabled = False '關閉計時器
End Sub
Private Sub Command1_Click() '“倒計時”
m = Val(Text1.Text)
s = Val(Text2.Text)
Timer1.Enabled = True '打開計時器
End Sub
Private Sub Timer1_Timer()
If s > 0 Then
s = s - 1
Else
If m > 0 Then
m = m - 1
s = 59
End If
End If
Text1.Text = Format(m, "00")
Text2.Text = Format(s, "00")
If s = 0 And m = 0 Then
Beep '響鈴,即讓喇叭發一聲響
MsgBox "計時結束"
Unload Me
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -