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

📄 form1.frm

📁 很多的vb经典源代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "倒计时器"
   ClientHeight    =   1770
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4230
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1770
   ScaleWidth      =   4230
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      Height          =   495
      Left            =   2760
      TabIndex        =   3
      Top             =   1080
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "开始倒计时"
      Height          =   495
      Left            =   1560
      TabIndex        =   2
      Top             =   1080
      Width           =   1215
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   0
      Top             =   1440
   End
   Begin VB.CommandButton Command1 
      Caption         =   "设置倒计时间"
      Height          =   495
      Left            =   240
      TabIndex        =   1
      Top             =   1080
      Width           =   1335
   End
   Begin VB.Label Label1 
      BackColor       =   &H80000012&
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   27.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000E&
      Height          =   615
      Left            =   960
      TabIndex        =   0
      Top             =   240
      Width           =   2340
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
    Dim temp, Hs, Ms As String, valuetime As Integer
    temp = InputBox("请输入倒计时数(以分钟为单位):", "设置倒计时")
    valuetime = Val(temp)
    hh = Int(valuetime / 60)  '获得小时部分
    mm = valuetime - hh * 60
    ss = 0
    Label1.Caption = hmsValueToString(hh, mm, ss)

End Sub

Private Sub Command2_Click()
    Timer1.Enabled = True
    
End Sub

Private Sub Command3_Click()
    End
End Sub

Private Sub Timer1_Timer()
     If ss < 1 Then '如果秒位已为0,则向高位借
        If mm < 1 Then  '若分位也已为0,则向小时位借
           If hh < 1 Then
              Timer1.Enabled = False
              MsgBox "时间到"
              Exit Sub
           Else
              hh = hh - 1
              mm = 59
              ss = 60
           End If
        Else
           mm = mm - 1
           ss = 60
        End If
     End If
     ss = ss - 1    '秒数减1
     '------将本次剩余时间转换为HH:MM:SS格式
     Label1.Caption = hmsValueToString(hh, mm, ss)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -