Results 1 to 9 of 9

Thread: ProgressBar on a StatusBar Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Location
    Venezuela
    Posts
    2

    Question ProgressBar on a StatusBar Control

    I need to make a Progress Bar on a StatusBarPanel Object to change it from any form on my project. Any Help?

  2. #2

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Location
    Venezuela
    Posts
    2

    An easy way

    I did it calling the DrawItem event of the StatusBar after setting the style of the StatusBarPanel to owner-draw. On the event I create a rectangle object to draw the progressbar. To set the width of the progress bar and refresh the StatusBarPanel I load the text property of the StatusBarPanel with the new width and take it from there to asign it to the rectangle.

    I dont think this is the best way to do it and I have spend so many time on doing this. Please I need some help here...

  3. #3
    Addicted Member
    Join Date
    Jun 2002
    Location
    Brisbane Australia
    Posts
    150

    Prgress Bar on Status Bar

    I did a search on the forum and found your post as this is exactly what I am trying to do.
    Balena's MS book says "Panels can have an owner-draw style, so you can define their appearance in the DrawItem event. For example, you might use this feature to display an animated icon or a progress Bar inside the Sataus Bar Control" - but dosn't tell us how to do it.

    Have you progressed further with your code ( I know its an old post) or does any body know how to do this.

    Can you show how you have achieved this so far - I don't care if you feel its messy - I'd just like make it work

    Thanks Brian

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I took different version I found on the web and adding my own thing to them and here is what I got. If I kept original code from another source then I kept a link to it in the code comments so you can see the source. This seems to be exactly what that event was meant for.

  5. #5
    Addicted Member
    Join Date
    Jun 2002
    Location
    Brisbane Australia
    Posts
    150

    Progress Bar on Status Bar

    Hi Edneeis
    thanks for the reply. However I am still a little lost as to how to use it - do you have some sample code of how to use this class to actually display a percentage type progress bar
    regards
    BH

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    That solution has an example of how to use it, sorry I didn't stick comments in that one.

    Basically you can use it two ways you can either replace a normal panel in the statusbar with a progresspanel or just add a progresspanel directly to the status bar. The only different is what you pass into the contructor. Either pass a statusbarpanel object that you want to replace or a statusbar on which to add the new panel.

    Here is some code to replace an existing panel:
    VB Code:
    1. Dim pnl As ProgressPanel
    2.  
    3.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    4.         'use the constructor below to replace an existing panel
    5.         pnl = New ProgressPanel(StatusBarPanel1)
    6.         'set the autotext to show the percent of progress
    7.         pnl.TextStyle = ProgressPanel.ProgressTextStyle.Percent
    8.         pnl.TextAlignment = ContentAlignment.MiddleCenter
    9.         'set the max value
    10.         pnl.Maximum = 10
    11.         pnl.Value = 5
    12.         'set the tooltip the same as the text
    13.         pnl.ToolTipText = pnl.GetText(ProgressPanel.ProgressTextStyle.Percent)
    14.         'set the bar color, use the same color for a solid color otherwise it is gradient
    15.         pnl.BarColor1 = Color.Red
    16.         pnl.BarColor2 = Color.Green
    17.         pnl.ForeColor = Color.White
    18.     End Sub

  7. #7
    Addicted Member
    Join Date
    Jun 2002
    Location
    Brisbane Australia
    Posts
    150

    progress bar on a status bar

    thanks for your reply. The code was in your attachement after all and I can see how it works - it'sust what I need - thank you

    regards

    BH

  8. #8
    New Member
    Join Date
    Aug 2002
    Posts
    10

    Talking Great code

    This class is great!!! Thanks, Edneeis!!!

  9. #9
    New Member
    Join Date
    Aug 2002
    Posts
    10

    Talking Great code

    This class is great!!! Thanks, Edneeis!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width