home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.UserControl AlarmCtl
- BackStyle = 0 'Transparent
- ClientHeight = 495
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 1800
- ScaleHeight = 495
- ScaleWidth = 1800
- Begin VB.Timer Timer1
- Enabled = 0 'False
- Interval = 1000
- Left = 825
- Top = 45
- End
- Begin VB.Label Label1
- Alignment = 2 'Center
- BackColor = &H00000080&
- BorderStyle = 1 'Fixed Single
- Caption = "00:00:00"
- BeginProperty Font
- Name = "Tahoma"
- Size = 14.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H0000FFFF&
- Height = 480
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 1800
- End
- Attribute VB_Name = "AlarmCtl"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = True
- Option Explicit
- Private startTime As Date
- Private Running As Boolean
- Private m_CountDown As Boolean
- Private m_AlarmTime As Date
- Event TimeOut()
- Private Sub Label1_Click()
- End Sub
- Private Sub Timer1_Timer()
- If m_CountDown Then
- If Time - m_AlarmTime > 0 Then
- Label1.Caption = "00:00:00"
- 'MsgBox "Time Out!"
- RaiseEvent TimeOut
- Timer1.Enabled = False
- Else
- Label1.Caption = Format$(Hour(m_AlarmTime - Time) & ":" & Minute(m_AlarmTime - Time) & ":" & Second(m_AlarmTime - Time), "hh:mm:ss")
- End If
- Else
- If Time - m_AlarmTime > 0 Then
- Label1.Caption = "00:00:00"
- 'MsgBox "Time Out!"
- RaiseEvent TimeOut
- Timer1.Enabled = False
- Else
- Label1.Caption = Format$(Hour(Time - startTime) & ":" & Minute(Time - startTime) & ":" & Second(Time - startTime), "hh:mm:ss")
- End If
- End If
- End Sub
- Public Property Get CountDown() As Boolean
- CountDown = m_CountDown
- End Property
- Public Property Let CountDown(ByVal vNewValue As Boolean)
- m_CountDown = vNewValue
- End Property
- Public Sub StartTimer()
- If Not Running Then
- Timer1.Enabled = True
- Running = True
- startTime = Time
- Label1.Caption = "00:00.00"
- End If
- End Sub
- Public Sub StopTimer()
- If Running Then
- Timer1.Enabled = False
- Running = False
- End If
- End Sub
- Private Sub UserControl_InitProperties()
- m_CountDown = True
- Running = False
- End Sub
- Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
- CountDown = PropBag.ReadProperty("countdown", CountDown)
- m_AlarmTime = PropBag.ReadProperty("AlarmTime", AlarmTime)
- End Sub
- Private Sub UserControl_Resize()
- UserControl.Size 1800, 500
-
- End Sub
- Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
- PropBag.WriteProperty "CountDown", m_CountDown, False
- PropBag.WriteProperty "AlarmTime", m_AlarmTime, 0
- End Sub
- Public Property Get AlarmTime() As Date
- AlarmTime = m_AlarmTime
- End Property
- Public Property Let AlarmTime(ByVal vNewValue As Date)
- If IsDate(vNewValue) Then m_AlarmTime = vNewValue
- End Property
-