Results 1 to 4 of 4

Thread: progress bar in status bar ..

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2009
    Posts
    5

    progress bar in status bar ..

    i am asking about using the progress bar into the status bar to move when i load any child form inside the MDIParent form . so anyone can help or have a code 4 it ..
    thanks

  2. #2
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    Re: progress bar in status bar ..

    I've been looking for that a couple years ago, I was Using VS 2005 then but it still work fine. Have a look at the following Class :

    VB.NET Code:
    1. 'This class merges the properties of a progress bar within a status bar
    2.  
    3. Public Class ProgressStatus : Inherits StatusBar
    4.   Public progressBar As New progressBar
    5.   Private _progressBar As Integer = -1
    6.  
    7.   Sub New()
    8.     progressBar.Hide()
    9.  
    10.     Me.Controls.Add(progressBar)
    11.   End Sub
    12.  
    13.   Public Property setProgressBar() As Integer
    14.     Get
    15.       Return _progressBar
    16.     End Get
    17.     Set(ByVal Value As Integer)
    18.       _progressBar = Value
    19.       Me.Panels(_progressBar).Style = StatusBarPanelStyle.OwnerDraw
    20.     End Set
    21.   End Property
    22.  
    23.   Private Sub Reposition(ByVal sender As Object, ByVal sbdevent As System.Windows.Forms.StatusBarDrawItemEventArgs) Handles MyBase.DrawItem
    24.     progressBar.Location = New Point(sbdevent.Bounds.X, sbdevent.Bounds.Y)
    25.     progressBar.Size = New Size(sbdevent.Bounds.Width, sbdevent.Bounds.Height)
    26.     progressBar.Show()
    27.   End Sub
    28. End Class

    All you have to do to be able to use it on a form is to declare it globaly Public or Private based on your needs on the form :

    VB.NET Code:
    1. Public StatusBar As New ProgressStatus
    Alex
    .NET developer
    "No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)

    Things to consider before posting.
    Don't forget to rate the posts if they helped and mark thread as resolved when they are.


    .Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
    My fresh new blog : writingthecode, even if I don't post much.

    System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0

  3. #3
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: progress bar in status bar ..

    Hi,

    Here's another way of doing it.
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  4. #4
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: progress bar in status bar ..

    I dont get it, why do all that code when you can just drag a StatusStrip control onto your form, then click it (in the designer) and select Progress Bar to add a ToolStripProgressBar control to it. Takes about 10 seconds.

    I dont think the OP was asking how to add a progress bar, I think he was more interested in how to make it move when loading an MDI child form... which is pretty simple if you just want it to continuously move - just set the Style property of the progress bar to Marquee right before you load the new MDI child form and then (assuming all the heavy loading is done on a background thread) when the loading is finished and the form is shown you set the Style property back to Blocks.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


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