|
-
Nov 24th, 2005, 10:41 PM
#1
Thread Starter
Frenzied Member
Some kind of process bar
Hello, is there a way to have a process bar in your application like the one you see when Windows XP starts up? It's not a progressbar, but a bar where several small squares move from left to right in the bar, telling you that a process is currently running.
Thanks.
-
Nov 24th, 2005, 10:45 PM
#2
Re: Some kind of process bar
Someone posted an animated GIF file that he made that was pretty good. I saw it this morning, so it should still be on the first page, as there haven't been too many threads since I left.
-
Nov 24th, 2005, 11:45 PM
#3
Thread Starter
Frenzied Member
Re: Some kind of process bar
-
Nov 24th, 2005, 11:54 PM
#4
Frenzied Member
Re: Some kind of process bar
-
Nov 25th, 2005, 08:52 AM
#5
Thread Starter
Frenzied Member
Re: Some kind of process bar
Thanks wiz126, but that's a progressbar. I'm executing command-line tools and there is no way I can determine how far the progress of a command-line tool is, so I can't update the progressbar while the tools are running.
Actually I was looking for something more like this:
-
Nov 25th, 2005, 03:10 PM
#6
Thread Starter
Frenzied Member
Re: Some kind of process bar
I've made a custom bar like the one on the picture above. It are several pictures that get changed on a timer interval, so it looks like it's one bar with moving squares.
It works great with the code below, but that means I need to have all the pictures stored somewhere on the computer, but I'd like to have the pictures inside the application.
Is it not possible to put several Image controls on top of each other and then use a timer to show them after each other? Or is there maybe another way of doing this?
This is the code I'm using now.
VB Code:
Private Sub Form_Load()
'Set up a list of pictures to show
PicArray(1) = "C:\1.bmp"
PicArray(2) = "C:\2.bmp"
PicArray(3) = "C:\3.bmp"
PicArray(4) = "C:\4.bmp"
PicArray(5) = "C:\5.bmp"
PicArray(6) = "C:\6.bmp"
PicArray(7) = "C:\7.bmp"
PicArray(8) = "C:\8.bmp"
PicArray(9) = "C:\9.bmp"
PicArray(10) = "C:\10.bmp"
'Set a variable to count the pictures done (or the slide number, in the slide show)
SlideCount = 1
'Set up the timer
Timer1.Enabled = True
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
'This will happen every 1000 millisecond
SlideCount = SlideCount + 1
If SlideCount > 10 Then SlideCount = 1
Set Image1.Picture = LoadPicture(PicArray(SlideCount))
End Sub
-
Nov 25th, 2005, 03:20 PM
#7
-
Nov 25th, 2005, 04:22 PM
#8
Re: Some kind of process bar
Here, I just wrote this:
Just put on the form a timer named tmrProcess, and a picturebox named picProcess, then paste this code in the form.
VB Code:
Option Explicit
Private Const PI As Double = 3.14159265358979
Private Sub Form_Load()
picProcess.ForeColor = vbBlue
picProcess.AutoRedraw = True
picProcess.BorderStyle = 0
picProcess.Appearance = 0
picProcess.BackColor = Me.BackColor
tmrProcess.Interval = 10
tmrProcess.Enabled = True
End Sub
Private Sub picProcess_Resize()
picProcess.Cls
End Sub
Private Sub tmrProcess_Timer()
Static PrevPos As Single, Direction As Boolean
Dim BHeight As Single, Pos As Single, K As Single
Dim BarLen As Single
BarLen = picProcess.ScaleWidth * 0.2
BHeight = picProcess.ScaleHeight - 15
picProcess.Circle (BHeight / 2, BHeight / 2), BHeight / 2, 0, PI * 0.5, PI * 1.5
picProcess.Circle (picProcess.ScaleWidth - BHeight / 2 - 15, BHeight / 2), BHeight / 2, 0, PI * 1.5, PI * 0.5
picProcess.Line (BHeight / 2, 0)-(picProcess.ScaleWidth - BHeight / 2, 0), 0
picProcess.Line (BHeight / 2 - 15, BHeight)-(picProcess.ScaleWidth - BHeight / 2, BHeight), 0
If PrevPos = 0 Then PrevPos = BHeight / 2
If Not Direction Then
Pos = PrevPos + picProcess.ScaleWidth * 0.015
If Pos + BarLen > picProcess.ScaleWidth - BHeight / 2 - 15 Then Direction = True
Else
Pos = PrevPos - picProcess.ScaleWidth * 0.015
If Pos < BHeight / 2 Then Direction = False
End If
picProcess.Line (PrevPos, 30)-(PrevPos + BarLen, BHeight - 30), picProcess.BackColor, BF
picProcess.Line (Pos, 30)-(Pos + BarLen, BHeight - 30), , BF
For K = Pos To Pos + BarLen Step picProcess.ScaleWidth * 0.05
picProcess.Line (K, 30)-(K, BHeight - 15), picProcess.BackColor
Next K
PrevPos = Pos
End Sub
-
Nov 25th, 2005, 07:48 PM
#9
Thread Starter
Frenzied Member
Re: Some kind of process bar
 Originally Posted by CVMichael
Here, I just wrote this:
Just put on the form a timer named tmrProcess, and a picturebox named picProcess, then paste this code in the form.
That looks great. Thank you.
Now I need to use both bars
-
Nov 25th, 2005, 07:51 PM
#10
Re: Some kind of process bar
What does that even mean?
-
Nov 25th, 2005, 04:20 PM
#11
Thread Starter
Frenzied Member
Re: Some kind of process bar
Thanks, Mc Brain. That looks very nice. I'll use that one. All the BMP pictures that I have now, make the size of the application 3 times bigger.
-
Nov 25th, 2005, 04:30 PM
#12
-
Nov 25th, 2005, 07:59 PM
#13
Thread Starter
Frenzied Member
Re: Some kind of process bar
I'm not sure what you're talking about, dglienna.
EDIT: Is it about your post?
I did use the bar you pointed me to, but that bar (gif) is really small. When I got other solutions from Mc Brain and CVMichael, which are better for my application, I started to use them instead. I'm not trying to be rude or ungrateful, but if I get several solutions, then I use the best ones.
Last edited by Chris001; Nov 25th, 2005 at 09:02 PM.
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
|