|
-
Mar 9th, 2013, 03:49 AM
#1
Thread Starter
Junior Member
[RESOLVED] How To Make The Progress Bar A Shot-Power Bar?
I'd like to know how to make the Progress Bar a shot-power gauge/bar.
In example, if the Minimum = 0, and Maximum = 100,
when the Progress Bar's value comes to 100, it will decrease again to 0,
the progress bar will stop when a button is clicked.
i have a code like this, but the powerbar's value stops at 90 or something,
Power_Tick //ProgressBar's Name
PowerBar.Step = 5
PowerBar.Value += 5
If PowerBar.Value >= PowerBar.Maximum Then
PowerBar.Value -= 5
ElseIf PowerBar.Value <= PowerBar.Minimum Then
PowerBar.Value += 5
End If
-
Mar 9th, 2013, 04:27 AM
#2
Re: How To Make The Progress Bar A Shot-Power Bar?
You need to set a boolean to indicate the direction. Your code will reach the maximum, then reduce the value by 5, then increase it again because it no longer satisfies the test >= .Maximum
In Power_Tick (I assume this is the timer's tick event.)
Static CountIncrease as Boolean = True
Then change the code you have to set CountIncrease to False when it reaches the maximum and set it to True when it reaches the Minimum.
Then use an If - Then checking CountIncrease and adding or subtracting as appropriate.
-
Mar 9th, 2013, 05:17 AM
#3
New Member
Re: How To Make The Progress Bar A Shot-Power Bar?
First you need to set a boolean outside the tick event. Say the boolean is m. I also assume your progress bar's name is PowerBar.
Then timer tick event should contain this code to work like you want.
If PowerBar.Value = 100 Then m = False
If PowerBar.Value = 0 Then m = True
If m Then
PowerBar.Value += 1
Else
PowerBar.Value -= 1
End If
-
Mar 9th, 2013, 08:45 AM
#4
Re: How To Make The Progress Bar A Shot-Power Bar?
You also need to get rid of the 2 lines above your if statement
-
Mar 9th, 2013, 09:54 AM
#5
Re: How To Make The Progress Bar A Shot-Power Bar?
 Originally Posted by Shakir.Ahmed
First you need to set a boolean outside the tick event.
It can be inside the tick event if it is declared as Static as I suggested.
-
Mar 9th, 2013, 11:11 AM
#6
Re: How To Make The Progress Bar A Shot-Power Bar?
There is a lag in the ProgressBar. The value may be 100, but it is showing something less.
-
Mar 9th, 2013, 11:40 AM
#7
Re: How To Make The Progress Bar A Shot-Power Bar?
 Originally Posted by dbasnett
There is a lag in the ProgressBar. The value may be 100, but it is showing something less.
The Prograss bar itself has no lag, the lag effect happens when "Animate controls" is enabled in windows (Visual Effects settings) which is enabled by default, Disable that setting and the progress bar control visually updates as expected.
Personally I hate all that extra animation crap and disable them.
-
Mar 9th, 2013, 11:57 AM
#8
Re: How To Make The Progress Bar A Shot-Power Bar?
Create your own! At the end of the day it's a line moving up and down on a drawing surface. There are so many ways to do it even for the artistically unimaginative!
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Mar 9th, 2013, 12:07 PM
#9
Re: How To Make The Progress Bar A Shot-Power Bar?
 Originally Posted by dunfiddlin
Create your own! At the end of the day it's a line moving up and down on a drawing surface. There are so many ways to do it even for the artistically unimaginative!
IOW if there is a way to tell a control not to use Windows control animations? I just can't see every commercial app having to re-invent the wheel and draw their own progress bars!
-
Mar 9th, 2013, 12:32 PM
#10
Re: How To Make The Progress Bar A Shot-Power Bar?
I think the assumption was that it was such an easy thing to do that there really wasn't much point in adding the control at all if it didn't make use of the fancy animation so, no. You can of course always use a scrollbar or a track bar as though it were a progress bar at a pinch. But truth is that progress bars are almost always far less necessary than anyone imagines and half the time are no more accurate as to actual progress than guessing! I can certainly think of better things to do with my eyes than lock them onto a progress bar!
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Mar 9th, 2013, 04:03 PM
#11
New Member
Re: How To Make The Progress Bar A Shot-Power Bar?
 Originally Posted by Españolita
It can be inside the tick event if it is declared as Static as I suggested.
Yeah. I also think so. There are many ways to do it right.
-
Mar 9th, 2013, 07:09 PM
#12
Thread Starter
Junior Member
Re: How To Make The Progress Bar A Shot-Power Bar?
where will I find that menu, on how to turn off the Animate Controls?
-
Mar 9th, 2013, 07:18 PM
#13
Thread Starter
Junior Member
Re: How To Make The Progress Bar A Shot-Power Bar?
Thank You To Everyone Who Posted! The Progress Bar's Value Is Now Increasing And Decreasing. I some of you know how to get the point of intersection of two power pack lines, kindly browse my other thread. I really need help on my program.
Tags for this Thread
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
|