|
-
Jun 29th, 2002, 11:39 AM
#1
Thread Starter
New Member
ProgressBar on a StatusBar Control
I need to make a Progress Bar on a StatusBarPanel Object to change it from any form on my project. Any Help?
-
Jun 29th, 2002, 10:44 PM
#2
Thread Starter
New Member
An easy way
I did it calling the DrawItem event of the StatusBar after setting the style of the StatusBarPanel to owner-draw. On the event I create a rectangle object to draw the progressbar. To set the width of the progress bar and refresh the StatusBarPanel I load the text property of the StatusBarPanel with the new width and take it from there to asign it to the rectangle.
I dont think this is the best way to do it and I have spend so many time on doing this. Please I need some help here...
-
Nov 6th, 2002, 01:58 AM
#3
Addicted Member
Prgress Bar on Status Bar
I did a search on the forum and found your post as this is exactly what I am trying to do.
Balena's MS book says "Panels can have an owner-draw style, so you can define their appearance in the DrawItem event. For example, you might use this feature to display an animated icon or a progress Bar inside the Sataus Bar Control" - but dosn't tell us how to do it.
Have you progressed further with your code ( I know its an old post) or does any body know how to do this.
Can you show how you have achieved this so far - I don't care if you feel its messy - I'd just like make it work
Thanks Brian
-
Nov 6th, 2002, 11:15 AM
#4
I took different version I found on the web and adding my own thing to them and here is what I got. If I kept original code from another source then I kept a link to it in the code comments so you can see the source. This seems to be exactly what that event was meant for.
-
Nov 7th, 2002, 05:30 PM
#5
Addicted Member
Progress Bar on Status Bar
Hi Edneeis
thanks for the reply. However I am still a little lost as to how to use it - do you have some sample code of how to use this class to actually display a percentage type progress bar
regards
BH
-
Nov 7th, 2002, 05:44 PM
#6
That solution has an example of how to use it, sorry I didn't stick comments in that one.
Basically you can use it two ways you can either replace a normal panel in the statusbar with a progresspanel or just add a progresspanel directly to the status bar. The only different is what you pass into the contructor. Either pass a statusbarpanel object that you want to replace or a statusbar on which to add the new panel.
Here is some code to replace an existing panel:
VB Code:
Dim pnl As ProgressPanel
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'use the constructor below to replace an existing panel
pnl = New ProgressPanel(StatusBarPanel1)
'set the autotext to show the percent of progress
pnl.TextStyle = ProgressPanel.ProgressTextStyle.Percent
pnl.TextAlignment = ContentAlignment.MiddleCenter
'set the max value
pnl.Maximum = 10
pnl.Value = 5
'set the tooltip the same as the text
pnl.ToolTipText = pnl.GetText(ProgressPanel.ProgressTextStyle.Percent)
'set the bar color, use the same color for a solid color otherwise it is gradient
pnl.BarColor1 = Color.Red
pnl.BarColor2 = Color.Green
pnl.ForeColor = Color.White
End Sub
-
Nov 8th, 2002, 03:39 AM
#7
Addicted Member
progress bar on a status bar
thanks for your reply. The code was in your attachement after all and I can see how it works - it'sust what I need - thank you
regards
BH
-
Nov 8th, 2002, 09:14 AM
#8
New Member
Great code
This class is great!!! Thanks, Edneeis!!!
-
Nov 8th, 2002, 09:52 AM
#9
New Member
Great code
This class is great!!! Thanks, Edneeis!!!
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
|