Option Explicit
'Our Bar(s)...
Private MyBar1 As New AMeter
Private MyBar2 As New AMeter
Private Function ChangeColor(ByVal lngColor As Long) As Long
CDL.CancelError = False
'On Error GoTo ccError
With CDL
.Flags = cdlCCFullOpen Or cdlCCRGBInit
.Color = lngColor
.ShowColor
ChangeColor = .Color
End With
'ccError:
End Function
Private Sub Command1_Click()
Timer1.Enabled = Not Timer1.Enabled
Draw 0
End Sub
'The actual darw occurs in the class module...
Private Sub Draw(ByVal intVal As Integer)
MyBar1.Draw intVal
'This gives Top2Down look...
MyBar2.Draw (100 - intVal)
Label1.Caption = intVal & "%"
End Sub
Private Sub Form_Load()
'Default Normal(Down2Top) Bar...
MyBar1.Surface = Picture2
'Default Top2Down Bar...
'Note just swaping the colors and
'(100-Val) gives us Top2Down look...
With MyBar2
.Surface = Picture1
.BarBackColor = MyBar1.BarForeColor
.BarForeColor = MyBar1.BarBackColor
End With
Label1.ForeColor = MyBar1.BarForeColor
'Ok, it's show time...
Command1.Value = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
Timer1.Enabled = False
End Sub
Private Sub mnuBackColor_Click()
MyBar1.BarBackColor = ChangeColor(MyBar1.BarBackColor)
MyBar2.BarForeColor = MyBar1.BarBackColor
End Sub
Private Sub mnuBarColor_Click()
With MyBar1
.BarForeColor = ChangeColor(.BarForeColor)
MyBar2.BarBackColor = .BarForeColor
Label1.ForeColor = .BarForeColor
End With 'MyBar1
End Sub
Private Sub Timer1_Timer()
'Each time a new value (1->100)...
Randomize
Draw Int((100 * Rnd) + 1)
End Sub