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
Printable View
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
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:
'This class merges the properties of a progress bar within a status bar Public Class ProgressStatus : Inherits StatusBar Public progressBar As New progressBar Private _progressBar As Integer = -1 Sub New() progressBar.Hide() Me.Controls.Add(progressBar) End Sub Public Property setProgressBar() As Integer Get Return _progressBar End Get Set(ByVal Value As Integer) _progressBar = Value Me.Panels(_progressBar).Style = StatusBarPanelStyle.OwnerDraw End Set End Property Private Sub Reposition(ByVal sender As Object, ByVal sbdevent As System.Windows.Forms.StatusBarDrawItemEventArgs) Handles MyBase.DrawItem progressBar.Location = New Point(sbdevent.Bounds.X, sbdevent.Bounds.Y) progressBar.Size = New Size(sbdevent.Bounds.Width, sbdevent.Bounds.Height) progressBar.Show() End Sub 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:
Public StatusBar As New ProgressStatus
Hi,
Here's another way of doing it.
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.