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

📄 frmclock.frm

📁 社区医疗系统实现了数字电压计参数的无线传送和温度参数的传送
💻 FRM
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form frmClock 
   Caption         =   "时钟"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame2 
      Caption         =   "请您定时"
      Height          =   1095
      Left            =   120
      TabIndex        =   9
      Top             =   1800
      Visible         =   0   'False
      Width           =   4095
      Begin VB.CheckBox chkAlarm 
         Caption         =   "闹钟无效"
         Height          =   180
         Left            =   120
         TabIndex        =   11
         Top             =   240
         Width           =   255
      End
      Begin VB.CommandButton cmdOK 
         Caption         =   "确定"
         Height          =   375
         Left            =   120
         TabIndex        =   10
         Top             =   600
         Width           =   975
      End
      Begin RichTextLib.RichTextBox rtbdate 
         Height          =   375
         Left            =   1200
         TabIndex        =   12
         Top             =   600
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   661
         _Version        =   393217
         Enabled         =   -1  'True
         TextRTF         =   $"frmClock.frx":0000
      End
      Begin RichTextLib.RichTextBox rtbtime 
         Height          =   375
         Left            =   2640
         TabIndex        =   13
         Top             =   600
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   661
         _Version        =   393217
         Enabled         =   -1  'True
         TextRTF         =   $"frmClock.frx":009D
      End
      Begin VB.Label lblDate 
         Caption         =   "日期"
         Height          =   255
         Left            =   1200
         TabIndex        =   16
         Top             =   240
         Width           =   855
      End
      Begin VB.Label lblTime 
         Caption         =   "时间"
         Height          =   255
         Left            =   2640
         TabIndex        =   15
         Top             =   240
         Width           =   855
      End
      Begin VB.Label lblAlarm 
         Alignment       =   2  'Center
         Caption         =   "取消闹钟"
         Height          =   255
         Left            =   360
         TabIndex        =   14
         Top             =   240
         Width           =   855
      End
   End
   Begin VB.Frame Frame1 
      Height          =   1335
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   4095
      Begin VB.CommandButton cmdTime 
         Caption         =   "计时"
         Height          =   255
         Left            =   1440
         TabIndex        =   6
         Top             =   960
         Width           =   615
      End
      Begin VB.CommandButton cmdCls 
         Caption         =   "清零"
         Enabled         =   0   'False
         Height          =   255
         Left            =   840
         TabIndex        =   5
         Top             =   960
         Width           =   615
      End
      Begin VB.CommandButton cmdStart 
         Caption         =   "开始"
         Enabled         =   0   'False
         Height          =   255
         Left            =   240
         TabIndex        =   4
         Top             =   960
         Width           =   615
      End
      Begin VB.CommandButton cmdDate 
         Caption         =   "日期"
         Height          =   255
         Left            =   2040
         TabIndex        =   3
         Top             =   960
         Width           =   615
      End
      Begin VB.CommandButton cmdClose 
         Caption         =   "关闭"
         Height          =   255
         Left            =   3240
         TabIndex        =   2
         Top             =   960
         Width           =   615
      End
      Begin VB.Timer Timer1 
         Interval        =   1000
         Left            =   1680
         Tag             =   "tttt"
         Top             =   0
      End
      Begin VB.CommandButton cmdAlarm 
         Caption         =   "闹钟"
         Height          =   255
         Left            =   2640
         TabIndex        =   1
         Top             =   960
         Width           =   615
      End
      Begin VB.Timer Timer2 
         Interval        =   1
         Left            =   2160
         Tag             =   "tttt"
         Top             =   0
      End
      Begin VB.Label lblShowTime 
         Alignment       =   2  'Center
         BackColor       =   &H80000002&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000E&
         Height          =   735
         Left            =   120
         TabIndex        =   8
         Top             =   120
         Width           =   3855
      End
      Begin VB.Label lblShowDate 
         BackColor       =   &H80000008&
         BackStyle       =   0  'Transparent
         ForeColor       =   &H00FFFFFF&
         Height          =   375
         Left            =   840
         TabIndex        =   7
         Top             =   480
         Width           =   2295
      End
   End
End
Attribute VB_Name = "frmClock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*****************************************
'                时钟程序
'程序功能:显示当前时间,计时,闹钟
'*****************************************
Private Alarmflag As Boolean
Private mytime, ttime, mydate, yourdate, yourtime As Date

Private Sub cmdStart_Click()
  If cmdStart.Caption = "开始" Then
    cmdStart.Caption = "停止"
    cmdCls.Enabled = False
  Else
    cmdStart.Caption = "开始"
    cmdCls.Enabled = True
  End If

End Sub

Private Sub cmdCls_Click()
  ttime = "0:00:00"
  lblShowTime.Caption = CStr(ttime)
End Sub

Private Sub cmdTime_Click()

  If cmdTime.Caption = "时间" Then
    cmdTime.Caption = "计时"
    ttime = "0:00:00"
    cmdStart.Enabled = False
    cmdCls.Enabled = False
  Else
    cmdTime.Caption = "时间"
    cmdStart.Enabled = True
    ttime = "0:00:00"
    lblShowTime.Caption = CStr(ttime)
  End If
End Sub

Private Sub cmdAlarm_Click()
  Alarmflag = Not Alarmflag
  If Alarmflag = True Then
    Me.Height = 2985
    Me.Frame2.Visible = True
  Else
    Me.Height = 1770
    Me.Frame2.Visible = False
  End If
End Sub

Private Sub cmdDate_Click()
  Me.lblShowDate.Caption = CStr(mydate)
End Sub

Private Sub cmdClose_Click()
  Unload frmClock
End Sub

Private Sub cmdOK_Click()
  On Error GoTo err1
    Me.Frame2.Visible = False
    Me.Height = 1770
    Alarmflag = False
    yourdate = CDate(rtbdate.Text)
    yourtime = CDate(rtbtime.Text)
    rtbdate.SaveFile (App.Path & "\date.txt")
    rtbtime.SaveFile (App.Path & "\time.txt")
err1:
    If Err = 0 Then Exit Sub
      MsgBox "请输入正确的时间格式"
      Me.Height = 2985
      Me.Frame2.Visible = True
      Alarmflag = True
End Sub

Private Sub Form_Load()
  On Error Resume Next
    Me.Height = 1770
    Alarmflag = False
    rtbdate.LoadFile (App.Path & ":\date.txt")
    yourdate = CDate(rtbdate.Text)
    rtbtime.LoadFile (App.Path & ":\time.txt")
    yourtime = CDate(rtbtime.Text)
    rtbdate.Text = CStr(Date)
    rtbtime.Text = CStr(Time)
    'Me.Show
End Sub

Private Sub Timer1_Timer() '主管闹钟
  If ((chkAlarm.value = 0) And Hour(mytime) = Hour(yourtime) And Minute(mytime) = Minute(yourtime) And (mydate = yourdate)) Then
    'Beep
    Y = sndPlaySound(App.Path & "/WAV/alarm.WAV", 1)
  End If
End Sub

Private Sub Timer2_Timer() '主管显示
  mydate = Date
  mytime = Time
  If cmdTime.Caption = "计时" Then
    lblShowTime.Caption = CStr(mytime)
  ElseIf (cmdTime.Caption = "时间" And cmdStart.Caption = "停止") Then
    lblShowTime.Caption = CStr(ttime)
    ttime = Format(TimeValue(ttime) + TimeValue("00:00:01"), "long time") '注意秒表的计时格式
  End If
End Sub

⌨️ 快捷键说明

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