VERSION 5.00
Begin VB.Form ProgBarDemo 
   Caption         =   "Form1"
   ClientHeight    =   1950
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5310
   LinkTopic       =   "Form1"
   ScaleHeight     =   1950
   ScaleWidth      =   5310
   StartUpPosition =   3  'Windows Default
   Begin VB.Timer Timer1 
      Interval        =   50
      Left            =   0
      Top             =   120
   End
   Begin VB.PictureBox Gauge 
      AutoRedraw      =   -1  'True
      BackColor       =   &H00FFFFFF&
      ForeColor       =   &H00000000&
      Height          =   420
      Left            =   480
      ScaleHeight     =   360
      ScaleWidth      =   3795
      TabIndex        =   0
      Top             =   120
      Width           =   3855
   End
   Begin VB.PictureBox InvisGauge 
      AutoRedraw      =   -1  'True
      BackColor       =   &H00C0C000&
      ForeColor       =   &H00FFFFFF&
      Height          =   420
      Left            =   480
      ScaleHeight     =   360
      ScaleWidth      =   3795
      TabIndex        =   1
      Top             =   600
      Visible         =   0   'False
      Width           =   3855
   End
   Begin VB.Label Label1 
      Caption         =   "For cooler effect, u can add a picture to the InvisGauge picture box. :-)"
      Height          =   495
      Left            =   600
      TabIndex        =   2
      Top             =   1080
      Width           =   3975
   End
End
Attribute VB_Name = "ProgBarDemo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

'by peet

Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
      ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _
      ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, _
      ByVal ySrc As Long, ByVal dwRop As Long) As Long

Private Const SRCCOPY = &HCC0020

Private Sub GaugeDisplay(dHowMuch As Double)
    Dim sPercent As String
    Dim iOldScaleMode As Integer
    Dim r As Integer
    sPercent = Format(dHowMuch, "0%")
    Gauge.Cls
    InvisGauge.Cls
    Gauge.CurrentX = (Gauge.Width - Gauge.TextWidth(sPercent)) / 2
    InvisGauge.CurrentX = Gauge.CurrentX
    Gauge.CurrentY = (Gauge.Height - Gauge.TextHeight(sPercent)) / 2
    InvisGauge.CurrentY = Gauge.CurrentY
    Gauge.Print sPercent
    InvisGauge.Print sPercent
    iOldScaleMode = Gauge.Parent.ScaleMode
    Gauge.Parent.ScaleMode = vbPixels
    r = BitBlt(Gauge.hDC, 0, 0, InvisGauge.Width * dHowMuch, InvisGauge.Height, InvisGauge.hDC, 0, 0, SRCCOPY)
    Gauge.Parent.ScaleMode = iOldScaleMode
End Sub

Private Sub Timer1_Timer()
    Static icount As Integer
    GaugeDisplay icount / 100
    icount = icount + 1
    If icount = 101 Then
        icount = 0
    End If
End Sub
