⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 VC做的语法分析程序
💻 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 + -