?? form1.frm
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "倒計時器"
ClientHeight = 1710
ClientLeft = 60
ClientTop = 345
ClientWidth = 4770
LinkTopic = "Form1"
ScaleHeight = 1710
ScaleWidth = 4770
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Left = 4200
Top = 240
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 3360
TabIndex = 3
Top = 1200
Width = 855
End
Begin VB.CommandButton Command2
Caption = "開始倒計時"
Height = 375
Left = 1920
TabIndex = 2
Top = 1200
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "設置倒計時間"
Height = 375
Left = 360
TabIndex = 1
Top = 1200
Width = 1335
End
Begin VB.Label Label1
BackColor = &H80000007&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋體"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C0FFFF&
Height = 615
Left = 840
TabIndex = 0
Top = 240
Width = 2895
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ss, mm, hh As Integer
Private Function hmstostring(ByVal h As Integer, ByVal m As Integer, ByVal s As Integer) As String
Dim hhs, mms, sss As String
If h < 10 Then
hhs = "0" + Trim(Str(h))
Else
hhs = Trim(Str(h))
End If
If m < 10 Then
mms = "0" + Trim(Str(m))
Else
mms = Trim(Str(m))
End If
If s < 10 Then
sss = "0" + Trim(Str(s))
Else
sss = Trim(Str(s))
End If
hmstostring = hhs + ":" + mms + ":" + sss
End Function
Private Sub Command1_Click()
temp = InputBox("please input a time", "time")
valuetime = Val(temp)
hh = Int(valuetime / 60)
mm = valuetime - hh * 60
ss = 0
Label1.Caption = hmstostring(hh, mm, ss)
End Sub
Private Sub Command2_Click()
Timer1.Interval = 1000
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Timer1_Timer()
If ss < 1 Then
If mm < 1 Then
If hh < 1 Then
Timer1.Interval = 0
MsgBox "It is timeout!!"
Exit Sub
Else
hh = hh - 1
mm = 59
ss = 60
End If
Else
mm = mm - 1
ss = 60
End If
Else
ss = ss - 1
End If
Label1.Caption = hmstostring(hh, mm, ss)
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -