VERSION 5.00
Begin VB.Form ProgressBar2 
   Caption         =   "Progrss Bar Demo 2"
   ClientHeight    =   495
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4860
   LinkTopic       =   "Form1"
   ScaleHeight     =   495
   ScaleWidth      =   4860
   StartUpPosition =   3  'Windows Default
   Begin VB.PictureBox Picture1 
      BackColor       =   &H00FFFFFF&
      FillColor       =   &H00800000&
      ForeColor       =   &H00800000&
      Height          =   275
      Left            =   383
      ScaleHeight     =   210
      ScaleWidth      =   4035
      TabIndex        =   0
      Top             =   110
      Width           =   4095
   End
   Begin VB.Timer Timer1 
      Interval        =   10
      Left            =   0
      Top             =   0
   End
End
Attribute VB_Name = "ProgressBar2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

''
'' By Richard Charlton
'' rpcharlton@blueyonder.co.uk
''

Private Const timeAllowed As Long = 10000  '' milliseconds
Private timeElapsed As Long

Private Sub Form_Load()
    timeElapsed = 0
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    If timeElapsed = timeAllowed Then
        MsgBox "Time's up!", vbCritical
        End
    End If
    timeElapsed = timeElapsed + 10
    DoPercent Picture1, (timeElapsed * 100) / timeAllowed
End Sub

Private Sub DoPercent(ByVal pic As PictureBox, ByVal lPercent As Single)
    pic.Scale (0, 0)-(100, 100)
    pic.Cls: Dim strPercent$
    pic.DrawMode = 13
    strPercent = Format$(Round(lPercent, 0)) & " %"
    pic.CurrentX = (pic.ScaleWidth - pic.TextWidth(strPercent)) / 2
    pic.CurrentY = (pic.ScaleHeight - pic.TextHeight(strPercent)) / 2
    pic.Print strPercent: pic.DrawMode = 10
    pic.Line (0, 0)-(lPercent, 100), &H800000, BF
End Sub
