VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "ProgressBar"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit

Private blnInit As Boolean
Private picProgress As PictureBox

Public Property Get Initialized() As Boolean
    Initialized = blnInit
End Property

Public Sub Init(pic As PictureBox)
    Set picProgress = pic
    With picProgress
        .AutoRedraw = True
        .DrawMode = 10 'Not XOR Pen
        .FillStyle = 0 'Solid
        .ForeColor = RGB(0, 0, 128)
    End With
    blnInit = True
End Sub

Public Sub Progress(iAmount As Integer)
Dim strAmount As String
    If Not blnInit Then
        MsgBox "You MUST call the Init method before using this object!", _
            vbCritical
        Exit Sub
    End If
    strAmount = Format(iAmount / 100, "0%")
    With picProgress
        .Cls
        .CurrentX = (.ScaleWidth - .TextWidth(strAmount)) \ 2
        .CurrentY = (.ScaleHeight - .TextHeight(strAmount)) \ 2
    End With
    picProgress.Print strAmount
    picProgress.Line (0, 0)-((picProgress.ScaleWidth / 100) _
        * iAmount, picProgress.ScaleHeight), picProgress.ForeColor, BF
End Sub
