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.
Re: Some kind of process bar
Re: Some kind of process bar
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:
http://img475.imageshack.us/img475/5739/bar0vy.png
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
Re: Some kind of process bar
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.
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
Re: Some kind of process bar
Glad I could help. I might look for a neweer version of it. I'm not sure if I corrected or improved anything... but I most probably have done it.
Re: Some kind of process bar
Quote:
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 :p
Re: Some kind of process bar
What does that even mean?
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.