|
-
Sep 16th, 2009, 08:34 AM
#1
Thread Starter
New Member
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
-
Sep 16th, 2009, 09:01 AM
#2
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:
'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
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 
-
Sep 16th, 2009, 09:05 AM
#3
Re: progress bar in status bar ..
Hi,
Here's another way of doing it.
-
Sep 16th, 2009, 09:27 AM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|