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

📄 闹钟.frm

📁 这是一个整点报时的小程序
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FrmClock 
   BackColor       =   &H80000000&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "定时闹钟程序"
   ClientHeight    =   1980
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4965
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   1980
   ScaleWidth      =   4965
   StartUpPosition =   1  '所有者中心
   Begin VB.Timer Timer3 
      Enabled         =   0   'False
      Interval        =   500
      Left            =   1860
      Top             =   2280
   End
   Begin VB.Timer Timer2 
      Interval        =   60
      Left            =   1200
      Top             =   2280
   End
   Begin VB.CommandButton Command2 
      Caption         =   "停止"
      Height          =   350
      Left            =   2400
      TabIndex        =   5
      Top             =   1605
      Width           =   735
   End
   Begin VB.Frame Frame2 
      Caption         =   "定时管理"
      Height          =   645
      Left            =   105
      TabIndex        =   3
      Top             =   930
      Width           =   3030
      Begin MSComCtl2.DTPicker DT1 
         Height          =   300
         Left            =   1620
         TabIndex        =   8
         Top             =   225
         Width           =   1260
         _ExtentX        =   2223
         _ExtentY        =   529
         _Version        =   393216
         Format          =   24969218
         CurrentDate     =   38657
      End
      Begin VB.Label Label2 
         Caption         =   "输入定时时间"
         Height          =   195
         Left            =   120
         TabIndex        =   4
         Top             =   360
         Width           =   1155
      End
   End
   Begin VB.Frame Frame1 
      Height          =   735
      Left            =   105
      TabIndex        =   0
      Top             =   135
      Width           =   3030
      Begin VB.TextBox Text1 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000C0&
         Height          =   315
         Left            =   1605
         TabIndex        =   2
         Top             =   300
         Width           =   1260
      End
      Begin VB.Label Label1 
         Caption         =   "当前系统时间"
         Height          =   210
         Left            =   225
         TabIndex        =   1
         Top             =   360
         Width           =   1170
      End
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   405
      Top             =   2280
   End
   Begin VB.Frame Frame3 
      Caption         =   "倒计时显示"
      Height          =   1815
      Left            =   3240
      TabIndex        =   6
      Top             =   120
      Width           =   1695
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         BackColor       =   &H8000000A&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00008000&
         Height          =   660
         Left            =   225
         TabIndex        =   7
         Top             =   600
         Width           =   1215
      End
   End
End
Attribute VB_Name = "FrmClock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
'Download by http://www.codefans.net
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim msTime As String

Private Sub Form_Load()
    Me.Icon = LoadResPicture(103, vbResIcon)
    Text1.Text = Time
End Sub

Private Sub Command2_Click()
    Timer3.Enabled = False
    Timer2.Enabled = False
    DT1.Value = 0
    Label3.Caption = vbNullString
End Sub

Private Sub Timer1_Timer()
    Text1.Text = Time
    DoEvents
End Sub

Private Sub Timer2_Timer()

    On Error Resume Next
    msTime = Format(DT1.Value, "hh:mm:ss")
    If msTime = "0:0:0" Then
        Label3.Caption = vbNullString
    Else
        If DateDiff("s", Format(Text1.Text, "hh:mm:ss"), msTime) >= 0 Then
            Label3.Caption = DateDiff("s", Format(Text1.Text, "hh:mm:ss"), msTime)
        Else
            Label3.Caption = vbNullString
        End If
    End If
    If Label3.Caption = "0" Then
        Label3.Caption = "闹铃已启动"
        Timer3.Enabled = True
        Timer2.Enabled = False
    End If
    DoEvents
End Sub

Private Sub Timer3_Timer()
    Sound.PlayWaveRes "101"
    DoEvents
End Sub

⌨️ 快捷键说明

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