VERSION 5.00
Begin VB.UserControl ProgressBar 
   AutoRedraw      =   -1  'True
   ClientHeight    =   255
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   1500
   ScaleHeight     =   17
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   100
   Begin VB.Timer Timer1 
      Interval        =   1
      Left            =   1800
      Top             =   1560
   End
End
Attribute VB_Name = "ProgressBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'|//////////////////////////////////////////////|
'|           <<<<JDH Productions>>>>            |
'|                                              |
'|                 ProgressBar                  |
'|                                              |
'|   I created this merely to learn about API   |
'|  and it turned out to be much bigger than I  |
'|        previously thought it would be.       |
'|                                              |
'|  The code is written from scratch. However I |
'|  did do some research on the APIs to aid me. |
'|                                              |
'|   Feel free to use this for any purpose. No  |
'|  credit is necesary, but don't claim this as |
'|                  your own!                   |
'|                                              |
'|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|

'||||||||||||||||||||||||||||||||||||||||||||||||
'|                   UPDATE LOG                 |
'| times are all central time (GMT -6)          |
'|                                              |
'| June  8, 2008 - 11:30PM                      |
'|               - Work Begins                  |
'|                                              |
'| June 10, 2008 - 11:10PM                      |
'|               - stream-lined code            |
'|                 removed many unnecessary     |
'|                 calculations and calls.      |
'|               - added Min and Max value      |
'|                                              |
'||||||||||||||||||||||||||||||||||||||||||||||||


Private Const pbVersion = "1.0.1"

Private Declare Function FillRect Lib "user32.dll" (ByVal hDC As Long, ByRef lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function SetTextColor Lib "gdi32.dll" (ByVal hDC As Long, ByVal crColor As Long) As Long
Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Long) As Long
Private Declare Function GradientFillRect Lib "msimg32" Alias "GradientFill" (ByVal hDC As Long, pVertex As TRIVERTEX, ByVal dwNumVertex As Long, pMesh As GRADIENT_RECT, ByVal dwNumMesh As Long, ByVal dwMode As Long) As Long
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hDC As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long

Private Type TRIVERTEX
    X As Long
    Y As Long
    Red As Integer
    Green As Integer
    Blue As Integer
    Alpha As Integer
End Type

Private Type GRADIENT_RECT
    UpperLeft As Long
    LowerRight As Long
End Type

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Const GRADIENT_FILL_RECT_H As Long = &H0
Const GRADIENT_FILL_RECT_V  As Long = &H1
Const GRADIENT_FILL_TRIANGLE As Long = &H2
Const GRADIENT_FILL_OP_FLAG As Long = &HFF


Private Const DT_BOTTOM = &H8
Private Const DT_CENTER = &H1
Private Const DT_LEFT = &H0
Private Const DT_RIGHT = &H2
Private Const DT_TOP = &H0
Private Const DT_VCENTER = &H4
Private Const DT_WORDBREAK = &H10
Private Const DT_SINGLELINE As Long = &H20

Dim lBrush As Long, TextCol(1) As Long
Dim sRed(3) As Long, sGreen(3) As Long, sBlue(3) As Long
'Default Property Values:
Const m_def_Value = 0
Const m_def_MinVal = 0
Const m_def_MaxVal = 100
Const m_def_BackTop = 789586
Const m_def_BackBottom = 1184386
Const m_def_FillTop = 2264894
Const m_def_FillBottom = 1466409
Const m_def_DropShadow = 1
Const m_def_Gradient = 1
Const m_def_FontColor = 16777215
Const m_def_BorderColor = 931353
Const m_def_ShowPercent = 1
'Property Variables:
Dim m_Value As Double
Dim m_MinVal As Double
Dim m_MaxVal As Double
Dim m_BackTop As OLE_COLOR
Dim m_BackBottom As Variant
Dim m_FillTop As OLE_COLOR
Dim m_FillBottom As OLE_COLOR
Dim m_DropShadow As Boolean
Dim m_Gradient As Boolean
Dim m_FontColor As OLE_COLOR
Dim m_BorderColor As OLE_COLOR
Dim m_ShowPercent As Boolean
Dim DisabledDark As Long, DisabledLight As Long, DisabledText As Long, DisabledShadow As Long
Dim bDrop As Boolean
Dim PercentText As String, PercentTextLen As Long
Dim PercentWidth As Long, HalfHeight As Long, BarWidth As Long, BarHeight As Long
'Event Declarations:
Event Click() 'MappingInfo=UserControl,UserControl,-1,Click
Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object."
Event DblClick() 'MappingInfo=UserControl,UserControl,-1,DblClick
Attribute DblClick.VB_Description = "Occurs when the user presses and releases a mouse button and then presses and releases it again over an object."
Event KeyDown(KeyCode As Integer, Shift As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyDown
Attribute KeyDown.VB_Description = "Occurs when the user presses a key while an object has the focus."
Event KeyPress(KeyAscii As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyPress
Attribute KeyPress.VB_Description = "Occurs when the user presses and releases an ANSI key."
Event KeyUp(KeyCode As Integer, Shift As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyUp
Attribute KeyUp.VB_Description = "Occurs when the user releases a key while an object has the focus."
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseDown
Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus."
Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseUp
Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseMove
Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse."
Event Paint() 'MappingInfo=UserControl,UserControl,-1,Paint
Attribute Paint.VB_Description = "Occurs when any part of a form or PictureBox control is moved, enlarged, or exposed."
Event Resize() 'MappingInfo=UserControl,UserControl,-1,Resize
Attribute Resize.VB_Description = "Occurs when a form is first displayed or the size of an object changes."

Private Function LongToUShort(Unsigned As Long) As Integer
    LongToUShort = CInt(Unsigned - &H10000)
End Function

Private Function GetColor(ByVal lColor As Long, Colors As Long)
    Dim iRed As Integer, iGreen As Integer, iBlue As Integer
    If Enabled = False Then Exit Function
    iRed = lColor And &HFF
    iGreen = (lColor \ &H100) And &HFF
    iBlue = lColor \ &H10000
    If iRed > 127 Then
        sRed(Colors) = LongToUShort(RGB(0, iRed, 0))
    Else
        sRed(Colors) = RGB(0, iRed, 0)
    End If
    If iGreen > 127 Then
        sGreen(Colors) = LongToUShort(RGB(0, iGreen, 0))
    Else
        sGreen(Colors) = RGB(0, iGreen, 0)
    End If
    If iBlue > 127 Then
        sBlue(Colors) = LongToUShort(RGB(0, iBlue, 0))
    Else
        sBlue(Colors) = RGB(0, iBlue, 0)
    End If
End Function

Private Sub Redraw()
    Dim vert(3) As TRIVERTEX
    Dim gRect As GRADIENT_RECT
    Dim sBorder As RECT, sShadow As RECT
    Dim brushes(3) As Long
    Dim Rectangles(3) As RECT

    Cls
    
    With sBorder
        .Left = 0
        .Top = 0
        .Right = UserControl.ScaleWidth
        .Bottom = UserControl.ScaleHeight
    End With
    
    With sShadow
        .Left = 2
        .Top = 2
        .Right = UserControl.ScaleWidth
        .Bottom = UserControl.ScaleHeight
    End With
    
    
    With vert(0)
        .X = 1
        .Y = 1
        .Red = sRed(0)
        .Green = sGreen(0)
        .Blue = sBlue(0)
        .Alpha = 0&
    End With
    
    With vert(1)
        .X = UserControl.ScaleWidth - 1
        .Y = UserControl.ScaleHeight - 1
        .Red = sRed(1)
        .Green = sGreen(1)
        .Blue = sBlue(1)
        .Alpha = 0&
    End With

    With vert(2)
        .X = 1
        .Y = 1
        .Red = sRed(2)
        .Green = sGreen(2)
        .Blue = sBlue(2)
        .Alpha = 0&
    End With

    With vert(3)
        .X = PercentWidth
        .Y = UserControl.ScaleHeight - 1
        .Red = sRed(3)
        .Green = sGreen(3)
        .Blue = sBlue(3)
        .Alpha = 0&
    End With
    
    gRect.UpperLeft = 0
    gRect.LowerRight = 1
    
    lBrush = CreateSolidBrush(m_BorderColor)
    If m_Gradient Then
        FillRect UserControl.hDC, sBorder, lBrush
        GradientFillRect UserControl.hDC, vert(0), 2, gRect, 1, GRADIENT_FILL_RECT_V
        GradientFillRect UserControl.hDC, vert(2), 2, gRect, 1, GRADIENT_FILL_RECT_V
    Else
        brushes(0) = CreateSolidBrush(m_BackTop)
        brushes(1) = CreateSolidBrush(m_BackBottom)
        brushes(2) = CreateSolidBrush(m_FillTop)
        brushes(3) = CreateSolidBrush(m_FillBottom)
        With Rectangles(0)
            .Left = 1
            .Top = 1
            .Right = BarWidth
            .Bottom = HalfHeight
        End With
        With Rectangles(1)
            .Left = 1
            .Top = HalfHeight
            .Right = BarWidth
            .Bottom = BarHeight
        End With
        With Rectangles(2)
            .Left = 1
            .Top = 1
            .Right = PercentWidth
            .Bottom = HalfHeight
        End With
        With Rectangles(3)
            .Left = 1
            .Top = HalfHeight
            .Right = PercentWidth
            .Bottom = BarHeight
        End With
        FillRect UserControl.hDC, sBorder, lBrush
        FillRect UserControl.hDC, Rectangles(0), brushes(0)
        FillRect UserControl.hDC, Rectangles(1), brushes(1)
        FillRect UserControl.hDC, Rectangles(2), brushes(2)
        FillRect UserControl.hDC, Rectangles(3), brushes(3)
        For i = 0 To 3
            DeleteObject brushes(i)
        Next
    End If
    If m_ShowPercent = True Then
        SetTextColor UserControl.hDC, TextCol(1)
        If bDrop = True Then DrawText UserControl.hDC, PercentText, PercentTextLen, sShadow, DT_SINGLELINE Or DT_VCENTER Or DT_CENTER
        SetTextColor UserControl.hDC, TextCol(0)
        DrawText UserControl.hDC, PercentText, PercentTextLen, sBorder, DT_SINGLELINE Or DT_VCENTER Or DT_CENTER
    End If
    DeleteObject lBrush
End Sub

Private Function CheckEnabled() As Boolean
    CheckEnabled = Enabled
    If Enabled = False Then
        sRed(0) = DisabledLight
        sGreen(0) = DisabledLight
        sBlue(0) = DisabledLight
        sRed(1) = DisabledDark
        sGreen(1) = DisabledDark
        sBlue(1) = DisabledDark
        sRed(2) = DisabledDark
        sGreen(2) = DisabledDark
        sBlue(2) = DisabledDark
        sRed(3) = DisabledLight
        sGreen(3) = DisabledLight
        sBlue(3) = DisabledLight
        TextCol(0) = DisabledText
        TextCol(1) = DisabledShadow
        bDrop = True
    Else
        GetColor m_BackTop, 0
        GetColor m_BackBottom, 1
        GetColor m_FillTop, 2
        GetColor m_FillBottom, 3
        TextCol(0) = m_FontColor
        TextCol(1) = vbBlack
        bDrop = m_DropShadow
    End If
End Function

Private Function CheckPercent()
    PercentWidth = IIf(m_Value > m_MinVal, UserControl.ScaleWidth - (((UserControl.ScaleWidth / m_MaxVal)) * (m_MaxVal - Value + m_MinVal)) - 1, 1)
    HalfHeight = UserControl.ScaleHeight / 2
    BarWidth = UserControl.ScaleWidth - 1
    BarHeight = UserControl.ScaleHeight - 1
    PercentText = ((m_Value - m_MinVal) / m_MaxVal) * 100 & " %"
    PercentTextLen = Len(PercentText)
End Function

Private Sub UserControl_Click()
    RaiseEvent Click
End Sub

Private Sub UserControl_DblClick()
    RaiseEvent DblClick
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,Enabled
Public Property Get Enabled() As Boolean
Attribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events."
    Enabled = UserControl.Enabled
End Property

Public Property Let Enabled(ByVal New_Enabled As Boolean)
    UserControl.Enabled() = New_Enabled
    PropertyChanged "Enabled"
    CheckEnabled
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,hDC
Public Property Get hDC() As Long
Attribute hDC.VB_Description = "Returns a handle (from Microsoft Windows) to the object's device context."
    hDC = UserControl.hDC
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,hWnd
Public Property Get hWnd() As Long
Attribute hWnd.VB_Description = "Returns a handle (from Microsoft Windows) to an object's window."
    hWnd = UserControl.hWnd
End Property

Private Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer)
    RaiseEvent KeyDown(KeyCode, Shift)
End Sub

Private Sub UserControl_KeyPress(KeyAscii As Integer)
    RaiseEvent KeyPress(KeyAscii)
End Sub

Private Sub UserControl_KeyUp(KeyCode As Integer, Shift As Integer)
    RaiseEvent KeyUp(KeyCode, Shift)
End Sub

Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseDown(Button, Shift, X, Y)
End Sub

Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseUp(Button, Shift, X, Y)
End Sub

Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseMove(Button, Shift, X, Y)
    Redraw
End Sub

Private Sub UserControl_Paint()
    RaiseEvent Paint
    Redraw
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,Refresh
Public Sub Refresh()
Attribute Refresh.VB_Description = "Forces a complete repaint of a object."
    UserControl.Refresh
    Redraw
End Sub

Private Sub UserControl_Resize()
    RaiseEvent Resize
    CheckPercent
    Redraw
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,789586
Public Property Get BackTop() As OLE_COLOR
Attribute BackTop.VB_Description = "Top color of the background"
    BackTop = m_BackTop
End Property

Public Property Let BackTop(ByVal New_BackTop As OLE_COLOR)
    m_BackTop = New_BackTop
    PropertyChanged "BackTop"
    GetColor m_BackTop, 0
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=14,0,0,1184386
Public Property Get BackBottom() As OLE_COLOR
    BackBottom = m_BackBottom
End Property

Public Property Let BackBottom(ByVal New_BackBottom As OLE_COLOR)
    m_BackBottom = New_BackBottom
    PropertyChanged "BackBottom"
    GetColor m_BackBottom, 1
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,2264894
Public Property Get FillTop() As OLE_COLOR
Attribute FillTop.VB_Description = "Sets the top fill color"
    FillTop = m_FillTop
End Property

Public Property Let FillTop(ByVal New_FillTop As OLE_COLOR)
    m_FillTop = New_FillTop
    PropertyChanged "FillTop"
    GetColor m_FillTop, 2
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,1466409
Public Property Get FillBottom() As OLE_COLOR
Attribute FillBottom.VB_Description = "Sets the bottom fill color."
    FillBottom = m_FillBottom
End Property

Public Property Let FillBottom(ByVal New_FillBottom As OLE_COLOR)
    m_FillBottom = New_FillBottom
    PropertyChanged "FillBottom"
    GetColor m_FillBottom, 3
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=0,0,0,1
Public Property Get DropShadow() As Boolean
Attribute DropShadow.VB_Description = "Allows a drop shadow"
    DropShadow = m_DropShadow
End Property

Public Property Let DropShadow(ByVal New_DropShadow As Boolean)
    m_DropShadow = New_DropShadow
    PropertyChanged "DropShadow"
    bDrop = m_DropShadow
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=0,0,0,1
Public Property Get Gradient() As Boolean
    Gradient = m_Gradient
End Property

Public Property Let Gradient(ByVal New_Gradient As Boolean)
    m_Gradient = New_Gradient
    PropertyChanged "Gradient"
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,16777215
Public Property Get FontColor() As OLE_COLOR
Attribute FontColor.VB_Description = "Sets the font color."
    FontColor = m_FontColor
End Property

Public Property Let FontColor(ByVal New_FontColor As OLE_COLOR)
    m_FontColor = New_FontColor
    PropertyChanged "FontColor"
    TextCol(0) = m_FontColor
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,931353
Public Property Get BorderColor() As OLE_COLOR
Attribute BorderColor.VB_Description = "Sets the border color."
    BorderColor = m_BorderColor
End Property

Public Property Let BorderColor(ByVal New_BorderColor As OLE_COLOR)
    m_BorderColor = New_BorderColor
    PropertyChanged "BorderColor"
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=0,0,0,1
Public Property Get ShowPercent() As Boolean
    ShowPercent = m_ShowPercent
End Property

Public Property Let ShowPercent(ByVal New_ShowPercent As Boolean)
    m_ShowPercent = New_ShowPercent
    PropertyChanged "ShowPercent"
    Redraw
End Property

'Initialize Properties for User Control
Private Sub UserControl_InitProperties()
    m_BackTop = m_def_BackTop
    m_BackBottom = m_def_BackBottom
    m_FillTop = m_def_FillTop
    m_FillBottom = m_def_FillBottom
    m_DropShadow = m_def_DropShadow
    m_Gradient = m_def_Gradient
    m_FontColor = m_def_FontColor
    m_BorderColor = m_def_BorderColor
    m_ShowPercent = m_def_ShowPercent
    m_Value = m_def_Value
    m_MinVal = m_def_MinVal
    m_MaxVal = m_def_MaxVal
    DisabledDark = RGB(0, 50, 0)
    DisabledLight = RGB(0, 100, 0)
    DisabledText = RGB(100, 100, 100)
    DisabledShadow = RGB(150, 150, 150)
    CheckEnabled
    CheckPercent
    Redraw
End Sub

'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    UserControl.Enabled = PropBag.ReadProperty("Enabled", True)
    m_BackTop = PropBag.ReadProperty("BackTop", m_def_BackTop)
    m_BackBottom = PropBag.ReadProperty("BackBottom", m_def_BackBottom)
    m_FillTop = PropBag.ReadProperty("FillTop", m_def_FillTop)
    m_FillBottom = PropBag.ReadProperty("FillBottom", m_def_FillBottom)
    m_DropShadow = PropBag.ReadProperty("DropShadow", m_def_DropShadow)
    m_Gradient = PropBag.ReadProperty("Gradient", m_def_Gradient)
    m_FontColor = PropBag.ReadProperty("FontColor", m_def_FontColor)
    m_BorderColor = PropBag.ReadProperty("BorderColor", m_def_BorderColor)
    m_ShowPercent = PropBag.ReadProperty("ShowPercent", m_def_ShowPercent)
    m_Value = PropBag.ReadProperty("Value", m_def_Value)
    m_MinVal = PropBag.ReadProperty("MinVal", m_def_MinVal)
    m_MaxVal = PropBag.ReadProperty("MaxVal", m_def_MaxVal)
    DisabledDark = RGB(0, 50, 0)
    DisabledLight = RGB(0, 100, 0)
    DisabledText = RGB(100, 100, 100)
    DisabledShadow = RGB(150, 150, 150)
    CheckEnabled
    CheckPercent
    Redraw
End Sub

'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    Call PropBag.WriteProperty("Enabled", UserControl.Enabled, True)
    Call PropBag.WriteProperty("BackTop", m_BackTop, m_def_BackTop)
    Call PropBag.WriteProperty("BackBottom", m_BackBottom, m_def_BackBottom)
    Call PropBag.WriteProperty("FillTop", m_FillTop, m_def_FillTop)
    Call PropBag.WriteProperty("FillBottom", m_FillBottom, m_def_FillBottom)
    Call PropBag.WriteProperty("DropShadow", m_DropShadow, m_def_DropShadow)
    Call PropBag.WriteProperty("Gradient", m_Gradient, m_def_Gradient)
    Call PropBag.WriteProperty("FontColor", m_FontColor, m_def_FontColor)
    Call PropBag.WriteProperty("BorderColor", m_BorderColor, m_def_BorderColor)
    Call PropBag.WriteProperty("ShowPercent", m_ShowPercent, m_def_ShowPercent)
    Call PropBag.WriteProperty("Value", m_Value, m_def_Value)
    Call PropBag.WriteProperty("MinVal", m_MinVal, m_def_MinVal)
    Call PropBag.WriteProperty("MaxVal", m_MaxVal, m_def_MaxVal)
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=4,0,0,0
Public Property Get Value() As Double
Attribute Value.VB_Description = "Sets the percentage."
    Value = m_Value
End Property

Public Property Let Value(ByVal New_Value As Double)
    If New_Value < m_MinVal Or New_Value > m_MaxVal Then MsgBox ("Error: Value must be greater than or equal to the minimum value and it must not exceed the maximum value."), vbExclamation, "ERROR!": Exit Property
    m_Value = New_Value
    PropertyChanged "Value"
    CheckPercent
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=4,0,0,0
Public Property Get MinVal() As Double
Attribute MinVal.VB_Description = "Minimum value"
    MinVal = m_MinVal
End Property

Public Property Let MinVal(ByVal New_MinVal As Double)
    If New_MinVal >= m_MaxVal Then MsgBox ("Error: Minimum value must be less than maximum value."), vbExclamation, "ERROR!": Exit Property
    If New_MinVal > m_Value Then MsgBox ("Error: Minimum value cannot excede the current value."), vbExclamation, "ERROR!": Exit Property
    m_MinVal = New_MinVal
    PropertyChanged "MinVal"
    CheckPercent
    Redraw
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=4,0,0,100
Public Property Get MaxVal() As Double
Attribute MaxVal.VB_Description = "Maximum value"
    MaxVal = m_MaxVal
End Property

Public Property Let MaxVal(ByVal New_MaxVal As Double)
    If New_MaxVal <= m_MinVal Then MsgBox ("Error: Maximum value must be greater than minimum value."), vbExclamation, "ERROR!": Exit Property
    If New_MaxVal < m_Value Then MsgBox ("Error: Current value cannont excede the maximum value."), vbExclamation, "ERROR!": Exit Property
    m_MaxVal = New_MaxVal
    PropertyChanged "MaxVal"
    CheckPercent
    Redraw
End Property

