VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "GStatusBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Private pos As Integer
Private m_MAX As Double
Private m_Value As Double

Dim lRed        As Long
Dim lGreen      As Long
Dim lBlue       As Long

Dim fRedStp     As Single
Dim fGreenStp   As Single
Dim fBlueStp    As Single

Private pic As PictureBox
Private divVal As Double

Public Sub SetParams(StartColor As ColorConstants, EndColor As ColorConstants, MAX As Double, horizOrver As Integer, p As PictureBox)
    
    m_MAX = MAX
    pos = horizOrver
    Set pic = p
    pic.ScaleMode = 3
    If pos = 0 Then
        divVal = pic.ScaleWidth
    Else
        divVal = pic.ScaleHeight
    End If
    
    lRed = (StartColor And &HFF&)
    lGreen = (StartColor And &HFF00&) / &H100&
    lBlue = (StartColor And &HFF0000) / &H10000

    fRedStp = CSng((EndColor And &HFF&) - lRed) / divVal
    fGreenStp = CSng(((EndColor And &HFF00&) / &H100&) - lGreen) / divVal
    fBlueStp = CSng(((EndColor And &HFF0000) / &H10000) - lBlue) / divVal
  
End Sub

Public Property Let Value(v As Double)
    
    m_Value = v
    
    If m_Value > m_MAX Then m_Value = m_MAX
    If m_Value < 0 Then m_Value = 0
    
    DrawLines m_Value
    
    pic.CurrentX = (pic.ScaleWidth \ 2) - 10
    pic.CurrentY = pic.ScaleHeight \ 3
    pic.ForeColor = vbBlue
    pic.Print (Value * 100) \ MAX & " %"
    
End Property

Public Property Get Value() As Double
    Value = m_Value
End Property

Public Property Get MAX() As Double
    MAX = m_MAX
End Property

Private Sub DrawLines(Value As Double)
    Dim i As Integer
    Dim j As Integer
    
    pic.ForeColor = st_Color
    pic.Cls
    If pos = 0 Then
        j = Value * pic.ScaleWidth / m_MAX
        For i = 0 To j
            pic.ForeColor = BlendColors(i)
            pic.Line (i, 0)-(i, pic.ScaleHeight)
        Next
    Else
        j = pic.ScaleHeight - (Value * pic.ScaleHeight / m_MAX)
        
        For i = pic.ScaleHeight To j Step -1
            pic.ForeColor = BlendColors(i)
            pic.Line (0, i)-(pic.ScaleWidth, i)
        Next
    End If
    
End Sub

Private Function BlendColors(i As Integer) As Long

    BlendColors = RGB(Abs((lRed + i * fRedStp)), Abs((lGreen + i * fGreenStp)), _
    Abs((lBlue + i * fBlueStp)))

End Function
