65.9K
CodeProject is changing. Read more.
Home

Animated Progress in Statusbar

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.72/5 (8 votes)

Oct 27, 2004

viewsIcon

109242

downloadIcon

552

Displays an animated progress in windows statusbar, NOT using the progressbar-control!

Animation created with Camtasia Studio 2 Evaluation Version

Introduction

This is just a code-snippet with which you can easily display a netscape-like progressbar in your windows-statusbar. It has 2 different modes: (determined by value of the control)
  • -1 = Animated Status, when remaining time is not calculateable
  • 0-100 = Normal Status displaying

How does it work?

It adds its own panel to your statusbar at runtime and handles all drawing in its own class.

The idea is based on Matthew Hazlett Implementation

Using the code

    Dim progress1 As ProgressStatus
    Private Sub Form1_Load(ByVal sender As System.Object,
      ByVal e As System.EventArgs) Handles MyBase.Load
        progress1 = New ProgressStatus(StatusBar1)
        With progress1
            .Style = StatusBarPanelStyle.OwnerDraw
            .MinWidth = 200
            .BorderStyle = StatusBarPanelBorderStyle.Raised
        End With
        StatusBar1.Panels.Add(progress1)
        Show()
    End Sub

You can change the value and the animation speed like following:

        progress1.progress = 53  'percent= possible values: 0-100 !

        progress1.progress = -1  'animates the bar

        progress1.Animspeed= 200 'ms!

Points of Interest

No flickering, because the panel adds its own picturebox and draw then to it!

History

  • 10/28/2004 first release
  • 10/28/2004 (later) 2nd release with own panel-class (no flickering) & cleaner code