by Prakash Patel and Nitin Patel (1 Submission)
Category: OLE/COM/DCOM/Active-X
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 1st September 2002
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Creates a simple yet powerful ActiveX (Progressbar) control with following features: - Displays % of task completed - You can set Foreground
'
Option Explicit
Private g_MinVal As Long
Private g_MaxVal As Long
Private g_Value As Long
Private g_Percent As Long
Private g_PercentColor As OLE_COLOR
Private g_FGColor As OLE_COLOR
Private g_BGColor As OLE_COLOR
Private Const gc_MAXVALUE = 2000000000 '2,147,483,647
Private Sub UserControl_Initialize()
lblDisplay.Width = 0
g_MaxVal = 100
g_MinVal = 1
g_Value = 1
g_Percent = 1
g_PercentColor = lblPercent.ForeColor
g_FGColor = lblDisplay.BackColor
g_BGColor = BackColor
End Sub
Private Sub UserControl_Resize()
lblDisplay.Height = Height
lblPercent.Top = (Height - lblPercent.Height) / 2
lblPercent.Left = (Width - lblPercent.Width) / 2
End Sub
Public Property Get Percent() As Long
Percent = g_Percent
End Property
Public Property Get PercentColor() As OLE_COLOR
PercentColor = g_PercentColor
End Property
Public Property Let PercentColor(ByVal inColor As OLE_COLOR)
lblPercent.ForeColor = inColor
g_PercentColor = inColor
End Property
Public Property Get FGColor() As OLE_COLOR
FGColor = g_FGColor
End Property
Public Property Let FGColor(ByVal inColor As OLE_COLOR)
lblDisplay.BackColor = inColor
g_FGColor = inColor
End Property
Public Property Get BGColor() As OLE_COLOR
BGColor = g_BGColor
End Property
Public Property Let BGColor(ByVal inColor As OLE_COLOR)
BackColor = inColor
g_BGColor = inColor
End Property
Public Property Get Min() As Long
Min = g_MinVal
End Property
Public Property Let Min(ByVal minValue As Long)
If minValue >= g_MaxVal Then
g_MinVal = g_MaxVal - 1
ElseIf g_MinVal <= 1 Then
g_MinVal = 1
Else
g_MinVal = minValue
End If
End Property
Public Property Get Max() As Long
Max = g_MaxVal
End Property
Public Property Let Max(ByVal maxValue As Long)
If maxValue <= g_MinVal Then
g_MaxVal = g_MinVal + 1
ElseIf g_MinVal >= gc_MAXVALUE Then
g_MinVal = gc_MAXVALUE
Else
g_MaxVal = maxValue
End If
End Property
Public Property Get Value() As Long
Value = g_Value
End Property
Public Property Let Value(ByVal lngValue As Long)
If lngValue >= g_MaxVal Then
g_Value = g_MaxVal
ElseIf lngValue <= g_MinVal Then
g_Value = g_MinVal
Else
g_Value = lngValue
End If
lblDisplay.Width = (g_Value / g_MaxVal) * Width
g_Percent = (g_Value / g_MaxVal) * 100
lblPercent.Caption = g_Percent & "%"
End Property
No comments have been posted about Creates a simple yet powerful ActiveX (Progressbar) control with following features: - Displays % o. Why not be the first to post a comment about Creates a simple yet powerful ActiveX (Progressbar) control with following features: - Displays % o.