Click here to Skip to main content
Licence 
First Posted 27 Oct 2004
Views 85,171
Bookmarked 25 times

Animated Progress in Statusbar

By | 27 Oct 2004 | Article
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

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

thomasdev

Engineer

Germany Germany

Member

Thomas is interested in technical programming, networking and security technologies.
 
Currently he's studying at a german university

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralSample app works great but doesn't when added to another project PinmemberAChatelain6:43 17 Apr '07  
GeneralRe: Sample app works great but doesn't when added to another project PinmemberAChatelain6:57 17 Apr '07  
QuestionVB.net Pinmemberbeena shah19:33 11 Dec '06  
QuestionWorks first time and not again PinmemberMMRR2:20 2 Aug '06  
GeneralAnimated status while loading database query [modified] Pinmemberabbasy0:22 17 Jul '06  
QuestionHow to Dispose of this? Pinmembermoon docker8:05 28 Jun '06  
QuestionStatus messages? Pinmembercknipe1:34 30 Nov '05  
AnswerRe: Status messages? Pinmembercknipe2:34 30 Nov '05  
GeneralNo refresh when programm has to work hard ... PinmemberSMaurer23:13 3 Nov '04  
GeneralRe: No refresh when programm has to work hard ... Pinmemberthomasdev2:47 4 Nov '04  
GeneralRe: No refresh when programm has to work hard ... PinmemberCaelib6:48 5 Nov '04  
GeneralRe: No refresh when programm has to work hard ... Pinmemberthomasdev4:20 6 Nov '04  
GeneralRe: No refresh when programm has to work hard ... PinmemberSMaurer5:41 6 Nov '04  
GeneralRe: No refresh when programm has to work hard ... Pinmemberthomasdev12:08 6 Nov '04  
GeneralRe: No refresh when programm has to work hard ... PinmemberSMaurer23:31 6 Nov '04  
GeneralRe: No refresh when programm has to work hard ... Pinmemberdscemama1:46 19 Jan '05  
The problem with DoEvent is that it allows the manipulation of the other controls in the form.
I'm developping a form that has several controls to define the search for items, a status bar where I would like to insert your control and a button to launch the search.
 
Here is an extract of the OnButtonClick function:
 
System.Windows.Forms.Cursor.Current = Cursors.WaitCursor
progress1.progress = -1 ' start your animated control
fillThread = New Threading.Thread(AddressOf SearchFunction)
fillThread.Start()
Do While fillThread.IsAlive
Application.DoEvents()
System.Threading.Thread.Sleep(1)
Loop
fillThread = Nothing
...
System.Windows.Forms.Cursor.Current = Cursors.Default

 
The DoEvent reset the mouse cursor to the default pointer instead of the WaitCursor.
If I add the instruction to change it in the loop, the mouse cursor is ok, but the user has access to all the controls in the form (he can change the values, click again on the search button and even close the form!)
 
Is there another way to make the control move than DoEvent ?
 
Thanks
David
GeneralRe: No refresh when programm has to work hard ... Pinmemberthomasdev11:41 20 Jan '05  
GeneralFlickering Pinmemberalcedes13:19 27 Oct '04  
GeneralRe: Flickering Pinmemberthomasdev22:12 27 Oct '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120528.1 | Last Updated 27 Oct 2004
Article Copyright 2004 by thomasdev
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid