Skip to content

ProgressBar Control ​

Wraps the msctls_progress32 system progress bar control for displaying operation progress, supporting standard, smooth, and marquee scrolling modes as well as taskbar progress display.

Enumerations ​

PrbOrientationConstants ​

ConstantValueDescription
PrbOrientationHorizontal0Horizontal orientation
PrbOrientationVertical1Vertical orientation

PrbScrollingConstants ​

ConstantValueDescription
PrbScrollingStandard0Standard mode
PrbScrollingSmooth1Smooth scrolling
PrbScrollingMarquee2Marquee mode

PrbStateConstants ​

ConstantValueDescription
PrbStateNormal1Normal state
PrbStateError2Error state (red)
PrbStatePaused3Paused state (yellow)

CCMousePointerConstants ​

See common enumerations.

Properties ​

Min ​

vb
Property Get Min() As Long
Property Let Min(ByVal Value As Long)

Minimum value.

Max ​

vb
Property Get Max() As Long
Property Let Max(ByVal Value As Long)

Maximum value.

Value ​

vb
Property Get Value() As Long
Property Let Value(ByVal Value As Long)

Current value.

Step ​

vb
Property Get Step() As Long
Property Let Step(ByVal Value As Long)

Step increment.

StepAutoReset ​

vb
Property Get StepAutoReset() As Boolean
Property Let StepAutoReset(ByVal Value As Boolean)

Whether to automatically reset to the minimum value when StepIt reaches the maximum.

MarqueeAnimation ​

vb
Property Get MarqueeAnimation() As Boolean
Property Let MarqueeAnimation(ByVal Value As Boolean)

Whether to enable marquee animation. Only effective when Scrolling is PrbScrollingMarquee.

MarqueeSpeed ​

vb
Property Get MarqueeSpeed() As Long
Property Let MarqueeSpeed(ByVal Value As Long)

Marquee animation speed in milliseconds. Only effective when Scrolling is PrbScrollingMarquee.

Orientation ​

vb
Property Get Orientation() As PrbOrientationConstants
Property Let Orientation(ByVal Value As PrbOrientationConstants)

Progress bar orientation.

Scrolling ​

vb
Property Get Scrolling() As PrbScrollingConstants
Property Let Scrolling(ByVal Value As PrbScrollingConstants)

Scrolling mode.

SmoothReverse ​

vb
Property Get SmoothReverse() As Boolean
Property Let SmoothReverse(ByVal Value As Boolean)

Whether to enable smooth reverse effect. Requires comctl32.dll version 6.0 or later.

BackColor ​

vb
Property Get BackColor() As OLE_COLOR
Property Let BackColor(ByVal Value As OLE_COLOR)

Background color.

ForeColor ​

vb
Property Get ForeColor() As OLE_COLOR
Property Let ForeColor(ByVal Value As OLE_COLOR)

Foreground color.

State ​

vb
Property Get State() As PrbStateConstants
Property Let State(ByVal Value As PrbStateConstants)

Progress bar state (normal/error/paused).

ShowInTaskBar ​

vb
Property Get ShowInTaskBar() As Boolean
Property Let ShowInTaskBar(ByVal Value As Boolean)

Whether to display progress on the taskbar. Requires Windows 7 or later.

Text ​

vb
Property Get Text() As String
Property Let Text(ByVal Value As String)

Text overlaid on the progress bar. Supports placeholders: {0} for current value, {1} for minimum value, {2} for maximum value, {3} for percentage value.

TextColor ​

vb
Property Get TextColor() As OLE_COLOR
Property Let TextColor(ByVal Value As OLE_COLOR)

Color of the overlay text.

BorderStyle ​

vb
Property Get BorderStyle() As Integer
Property Let BorderStyle(ByVal Value As Integer)

Border style (vbBSNone or vbFixedSingle).

VisualStyles ​

vb
Property Get VisualStyles() As Boolean
Property Let VisualStyles(ByVal Value As Boolean)

Whether to enable visual styles.

hWnd ​

vb
Property Get hWnd() As LongPtr

Window handle of the progress bar control.

hWndUserControl ​

vb
Property Get hWndUserControl() As LongPtr

Window handle of the user control.

Font ​

vb
Property Get Font() As StdFont
Property Let Font(ByVal NewFont As StdFont)
Property Set Font(ByVal NewFont As StdFont)

Font.

Enabled ​

vb
Property Get Enabled() As Boolean
Property Let Enabled(ByVal Value As Boolean)

Whether the control is enabled.

MousePointer ​

vb
Property Get MousePointer() As CCMousePointerConstants
Property Let MousePointer(ByVal Value As CCMousePointerConstants)

Mouse pointer style. See common enumerations.

MouseIcon ​

vb
Property Get MouseIcon() As IPictureDisp
Property Let MouseIcon(ByVal Value As IPictureDisp)
Property Set MouseIcon(ByVal Value As IPictureDisp)

Custom mouse icon.

MouseTrack ​

vb
Property Get MouseTrack() As Boolean
Property Let MouseTrack(ByVal Value As Boolean)

Whether to enable mouse enter/leave tracking.

Name ​

vb
Property Get Name() As String

Control name. Read-only.

Tag ​

vb
Property Get Tag() As String
Property Let Tag(ByVal Value As String)

Custom data.

Parent ​

vb
Property Get Parent() As Object

Parent object. Read-only.

Container ​

vb
Property Get Container() As Object
Property Set Container(ByVal Value As Object)

Container object.

Left ​

vb
Property Get Left() As Single
Property Let Left(ByVal Value As Single)

Left position.

Top ​

vb
Property Get Top() As Single
Property Let Top(ByVal Value As Single)

Top position.

Width ​

vb
Property Get Width() As Single
Property Let Width(ByVal Value As Single)

Width.

Height ​

vb
Property Get Height() As Single
Property Let Height(ByVal Value As Single)

Height.

Visible ​

vb
Property Get Visible() As Boolean
Property Let Visible(ByVal Value As Boolean)

Whether the control is visible.

ToolTipText ​

vb
Property Get ToolTipText() As String
Property Let ToolTipText(ByVal Value As String)

Tooltip text.

HelpContextID ​

vb
Property Get HelpContextID() As Long
Property Let HelpContextID(ByVal Value As Long)

Help context ID.

WhatsThisHelpID ​

vb
Property Get WhatsThisHelpID() As Long
Property Let WhatsThisHelpID(ByVal Value As Long)

"What's This" help ID.

DragIcon ​

vb
Property Get DragIcon() As IPictureDisp
Property Let DragIcon(ByVal Value As IPictureDisp)
Property Set DragIcon(ByVal Value As IPictureDisp)

Drag icon.

DragMode ​

vb
Property Get DragMode() As Integer
Property Let DragMode(ByVal Value As Integer)

Drag mode.

Methods ​

StepIt ​

vb
Public Sub StepIt()

Advances the current position by the increment specified by the Step property.

Increment ​

vb
Public Sub Increment(ByVal Delta As Long)

Advances the current position by the specified increment.

Drag ​

vb
Public Sub Drag([ByRef Action As Variant])

Starts, ends, or cancels a drag operation.

SetFocus ​

vb
Public Sub SetFocus()

Moves focus to the control.

ZOrder ​

vb
Public Sub ZOrder([ByRef Position As Variant])

Sets the Z-order of the control.

OLEDrag ​

vb
Public Sub OLEDrag()

Initiates an OLE drag operation.

Refresh ​

vb
Public Sub Refresh()

Forces the control to repaint.

Events ​

Change ​

vb
Public Event Change()

Fired when the Value property changes.

Click ​

vb
Public Event Click()

Fired when the control is clicked.

DblClick ​

vb
Public Event DblClick()

Fired when the control is double-clicked.

MouseDown ​

vb
Public Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Fired when a mouse button is pressed.

MouseUp ​

vb
Public Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Fired when a mouse button is released.

MouseMove ​

vb
Public Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Fired when the mouse is moved.

MouseEnter ​

vb
Public Event MouseEnter()

Fired when the mouse enters the control.

MouseLeave ​

vb
Public Event MouseLeave()

Fired when the mouse leaves the control.

KeyDown ​

vb
Public Event KeyDown(KeyCode As Integer, Shift As Integer)

Fired when a key is pressed.

KeyUp ​

vb
Public Event KeyUp(KeyCode As Integer, Shift As Integer)

Fired when a key is released.

KeyPress ​

vb
Public Event KeyPress(KeyChar As Integer)

Fired when a key character is input.

Code Examples ​

vb
' Standard progress bar
ProgressBar1.Min = 0
ProgressBar1.Max = 100
ProgressBar1.Value = 0
ProgressBar1.Step = 10
ProgressBar1.StepIt

' Progress bar with text overlay
ProgressBar1.Min = 0
ProgressBar1.Max = 1000
ProgressBar1.Text = "Processing {3}%"
ProgressBar1.TextColor = vbWhite

' Marquee mode (indeterminate progress)
ProgressBar1.Scrolling = PrbScrollingMarquee
ProgressBar1.MarqueeAnimation = True
ProgressBar1.MarqueeSpeed = 30

' Taskbar progress display (Windows 7+)
ProgressBar1.ShowInTaskBar = True
ProgressBar1.State = PrbStateNormal

twinBASIC and LOGO copyright of "WaynePhillipsEA" author