[2005] Smooth ProgressBar?
Hello everyone,
I am using the ProgressBar control, but I need it to have a continuous scale (like when you set Scrolling to 1 (= ccScrollingSmooth) in VB6). The blocks it uses now are not fine enough.
Setting Style to 'Continuous' won't work.
I use Windows XP Media Center Edition 2002 SP2.
Thanks.
Re: [2005] Smooth ProgressBar?
You cannot have a continous bar with visual styles enabled for the control. You might want to use a third-party progress bar. Have a look at the ElementsEx link in my signature.
Re: [2005] Smooth ProgressBar?
That looks nice, I'll have a look at those.
Re: [2005] Smooth ProgressBar?
you can do 1 of 2 things.
1) Turn of visual styles for your project, and you will be able to get a smooth scrolling on the continuous setting.. (the blocks are a result of visual styles) However turning off visual styles will be for the entire project, not just the one control..
2) Add the mscomctl.ocx to your toolbar, and then add the VB6 version of the progress bar to your form. VS should hook up the required references into your project. This progress bar won't use visual styles.
An even 3rd possible option, is to use some 3rd party DLL like the skybound visual styles one (which is free and works quite well). This component gives you the per control ability to enable/disable visual styles...
1 Attachment(s)
Re: [2005] Smooth ProgressBar?
In the meanwhile I found a half-solution.
Disable the option: "Enable XP visual styles" in the project's options.
This disables the 'skinning' of applications and makes your controls look like Win 98 controls.
Then enter in the MyBase.Load event code: Application.EnableVisualStyles()
This does change buttons and menu's back to their XP-layout, but the progressbar stays in it's Win 98-style, which DOES support smooth scrolling.
I also checked out the ElementsEX control, but for my application it has little extra to offer than the solution I use now and I would really like to stay with Window's default controls. :)
What I would really like is a smooth XP-style scrollbar, which must be possible to achieve. Because, for example, FireFox uses it in it's downloads screen (see the attachment).
Re: [2005] Smooth ProgressBar?
Quote:
Originally Posted by arsmakman
In the meanwhile I found a half-solution.
Disable the option: "Enable XP visual styles" in the project's options.
This disables the 'skinning' of applications and makes your controls look like Win 98 controls.
Then enter in the MyBase.Load event code: Application.EnableVisualStyles()
This does change buttons and menu's back to their XP-layout, but the progressbar stays in it's Win 98-style, which DOES support smooth scrolling.
I also checked out the ElementsEX control, but for my application it has little extra to offer than the solution I use now and I would really like to stay with Window's default controls. :)
What I would really like is a smooth XP-style scrollbar, which must be possible to achieve. Because, for example, FireFox uses it in it's downloads screen (see the attachment).
This scroll bar visual style comes with the "Royal" theme by Microsoft
EDIT: so if you try it on a computer that works on XP Pro with no Royal theme installed, it won't look the same
Re: [2005] Smooth ProgressBar?
Quote:
Originally Posted by ComputerJy
This scroll bar visual style comes with the "Royal" theme by Microsoft
EDIT: so if you try it on a computer that works on XP Pro with no Royal theme installed, it won't look the same
yeah but you can't really rely on a specific theme (especially one limited to a single OS)
I am sure it would be pretty simple to build the firefox style one.. progress bars are probably one of the easier controls to make, as they are just for display, and don't require any user interaction
1 Attachment(s)
Re: [2005] Smooth ProgressBar?
Quote:
Originally Posted by kleinma
yeah but you can't really rely on a specific theme (especially one limited to a single OS)
I am sure it would be pretty simple to build the firefox style one.. progress bars are probably one of the easier controls to make, as they are just for display, and don't require any user interaction
1- That's exactly what I said
2- it's not a firefox style, the style comes with the "Royal" style made by Microsoft not Mozilla
Re: [2005] Smooth ProgressBar?
Quote:
Originally Posted by ComputerJy
1- That's exactly what I said
2- it's not a firefox style, the style comes with the "Royal" style made by Microsoft not Mozilla
sorry, I didn't know you were referring to the firefox progress bar. I thought you were offering using that theme as a solution :wave:
Re: [2005] Smooth ProgressBar?
I guess the "best" answer is to inhertit the ProgressBar control and handle the drawing yourself. You might like to check out the XPCC link in my signature. That guy seems to know a lot about visual styles and drawing controls. He has articles on the site on the subject, plus you can check out his source code for the XP Common Controls library.
Re: [2005] Smooth ProgressBar?
John,
I was under the impression that a control needs to allow owner drawing via the ownerdrawn property to allow custom painting of the control... (like listbox, listview, etc...)
I never could get an OnPaint sub to fire in an inherited class unless I was able to set its OwnerDrawn property..
do you know a trick to get that to work?
Re: [2005] Smooth ProgressBar?
Quote:
Originally Posted by arsmakman
Hello everyone,
I am using the ProgressBar control, but I need it to have a continuous scale (like when you set Scrolling to 1 (= ccScrollingSmooth) in VB6). The blocks it uses now are not fine enough.
Setting Style to 'Continuous' won't work.
I use Windows XP Media Center Edition 2002 SP2.
Thanks.
Hi,
Here's a link where you can find some smooth progressbars;
http://www.codeproject.com/vb/net/SPB.asp
http://www.codeproject.com/vb/net/SmoothProgressBar.asp
http://www.codeproject.com/vb/net/Pe...rogressBar.asp
Try it,
sparrow1
Re: [2005] Smooth ProgressBar?
Quote:
Originally Posted by kleinma
do you know a trick to get that to work?
I think you'd have to inherit the class and do it from the inside.
That first link of sparrow's looks good. It is more visually appealling than the ones that look like the Windows Classic theme so it should fit in with XP themes better. If you use it you should make sure that you use colours from the SystemColors class so that they change with the current theme, rather than specifying absolute colours which may clash with some themes.
Re: [2005] Smooth ProgressBar?
I agree, like the codeproject and other examples out there, just roll-your-own. Progress bars are pretty easy to draw, and you can learn about creating custom controls, adding properties, double buffering, invalidating only the area that has changed, drawing in the paint event (or overriding it), fancy brushes (LinearGradientBrush)...
VB Code:
'2005
Public Class Form1
Dim pb As New ProgressBra
Dim WithEvents t As New Timer
Sub New()
InitializeComponent()
Me.Controls.Add(pb)
pb.Dock = DockStyle.Top
pb.Minimum = 0
pb.Maximum = 1000
t.Interval = 1
t.Start()
End Sub
Private Sub t_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles t.Tick
pb.Value += 1
' Only invalidate a small rectangle at the end of the progress bar, as that is all that changed
Dim endOfBar As Single = (pb.Value / pb.Maximum) * pb.ClientSize.Width
pb.Invalidate(New Rectangle(endOfBar - 1, 0, 2, pb.ClientSize.Height))
End Sub
End Class
Public Class ProgressBra
Inherits ProgressBar
Sub New()
Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer, True)
Me.UpdateStyles()
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
e.Graphics.FillRectangle(Brushes.Black, New Rectangle(0, 0, (Me.Value / Me.Maximum) * Me.ClientSize.Width, Me.ClientSize.Height))
End Sub
End Class
Re: [2005] Smooth ProgressBar?
I use Global Majic's Linear Gauge in my app, and it does the smooth progress bars that you are looking for. It also has the capability of an overlaying caption so you could show the percentage number overlaid on the progress bar as the progress bar is moving.
Smooth progress bars weren't the reason I bought it, but it was a nice side benefit. I was looking for a two-headed slider and Linear Gauge was the only one I could find.
The software can be found on componentsource.com. There is an ActiveX version and a .NET version.