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

📄 ftmrarray.frm

📁 一个很好用的增强的Timer库(可以取代VB的Timer控件).
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FTmrArray 
   Caption         =   "Timer Object Array"
   ClientHeight    =   3615
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4215
   Icon            =   "FTmrArray.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   3615
   ScaleWidth      =   4215
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdExit 
      Cancel          =   -1  'True
      Caption         =   "E&xit"
      Height          =   375
      Left            =   2160
      TabIndex        =   13
      Top             =   3120
      Width           =   1275
   End
   Begin VB.CommandButton cmdAbout 
      Caption         =   "&About"
      Default         =   -1  'True
      Height          =   375
      Left            =   720
      TabIndex        =   12
      Top             =   3120
      Width           =   1275
   End
   Begin VB.Frame Frame1 
      Caption         =   "Countdown Objects:"
      Height          =   2835
      Index           =   1
      Left            =   2160
      TabIndex        =   6
      Top             =   120
      Width           =   1875
      Begin VB.Label lblTimer 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "lblTimer()"
         ForeColor       =   &H80000008&
         Height          =   315
         Index           =   9
         Left            =   180
         TabIndex        =   11
         Top             =   2280
         Width           =   1515
      End
      Begin VB.Label lblTimer 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "lblTimer()"
         ForeColor       =   &H80000008&
         Height          =   315
         Index           =   8
         Left            =   180
         TabIndex        =   10
         Top             =   1800
         Width           =   1515
      End
      Begin VB.Label lblTimer 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "lblTimer()"
         ForeColor       =   &H80000008&
         Height          =   315
         Index           =   7
         Left            =   180
         TabIndex        =   9
         Top             =   1320
         Width           =   1515
      End
      Begin VB.Label lblTimer 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "lblTimer()"
         ForeColor       =   &H80000008&
         Height          =   315
         Index           =   6
         Left            =   180
         TabIndex        =   8
         Top             =   840
         Width           =   1515
      End
      Begin VB.Label lblTimer 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "lblTimer()"
         ForeColor       =   &H80000008&
         Height          =   315
         Index           =   5
         Left            =   180
         TabIndex        =   7
         Top             =   360
         Width           =   1515
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Timer Objects:"
      Height          =   2835
      Index           =   0
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   1875
      Begin VB.Label lblTimer 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "lblTimer()"
         Height          =   315
         Index           =   0
         Left            =   180
         TabIndex        =   5
         Top             =   360
         Width           =   1515
      End
      Begin VB.Label lblTimer 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "lblTimer()"
         Height          =   315
         Index           =   1
         Left            =   180
         TabIndex        =   4
         Top             =   840
         Width           =   1515
      End
      Begin VB.Label lblTimer 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "lblTimer()"
         Height          =   315
         Index           =   2
         Left            =   180
         TabIndex        =   3
         Top             =   1320
         Width           =   1515
      End
      Begin VB.Label lblTimer 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "lblTimer()"
         Height          =   315
         Index           =   3
         Left            =   180
         TabIndex        =   2
         Top             =   1800
         Width           =   1515
      End
      Begin VB.Label lblTimer 
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "lblTimer()"
         Height          =   315
         Index           =   4
         Left            =   180
         TabIndex        =   1
         Top             =   2280
         Width           =   1515
      End
   End
End
Attribute VB_Name = "FTmrArray"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Implements ICcrpTimerNotifyEx
Implements ICcrpCountdownNotifyEx

Private m_Tmr(0 To 4) As ccrpTimer
Private m_Cnt(0 To 4) As ccrpCountdown

Private Const Bump As Long = 200

Private Sub cmdAbout_Click()
   m_Tmr(0).About
End Sub

Private Sub cmdExit_Click()
   Unload Me
End Sub

Private Sub Form_Load()
   Dim i As Long
   
   For i = LBound(m_Tmr) To UBound(m_Tmr)
      Set m_Tmr(i) = New ccrpTimer
      With m_Tmr(i)
         .EventType = TimerPeriodic
         .Interval = (i + 1) * Bump
         Set .NotifyEx = Me
         .Stats.Frequency = 20
         .Enabled = True
      End With
      Set m_Cnt(i) = New ccrpCountdown
      With m_Cnt(i)
         .Duration = 100000
         .Interval = (i + 1) * Bump
         Set .NotifyEx = Me
         .Stats.Frequency = 20
         .Tag = i + 5
         .Enabled = True
      End With
   Next i
End Sub

Private Sub Form_Unload(Cancel As Integer)
   Dim i As Long
   For i = LBound(m_Tmr) To UBound(m_Tmr)
      m_Tmr(i).Enabled = False
      Set m_Tmr(i) = Nothing
      m_Cnt(i).Enabled = False
      Set m_Cnt(i) = Nothing
   Next i
End Sub

Private Sub ICcrpCountdownNotifyEx_Tick(ByVal TimeRemaining As Long, ByVal Tmr As ccrpTimers.ccrpCountdown)
   lblTimer(Tmr.Tag).Caption = " " & Format(TimeRemaining, "#,##0")
End Sub

Private Sub ICcrpCountdownNotifyEx_Timer(ByVal Tmr As ccrpTimers.ccrpCountdown)
   '
End Sub

Private Sub ICcrpTimerNotifyEx_Timer(ByVal Milliseconds As Long, ByVal Tmr As ccrpTimers.ccrpTimer)
   With Tmr
      .Tag = Val(.Tag) + .Interval + Milliseconds
      lblTimer((.Interval \ Bump) - 1).Caption = " " & Format(Val(.Tag), "#,##0")
   End With
End Sub

⌨️ 快捷键说明

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