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.
No matter how fool-proof your program is, there will always be a better fool.
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.
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...
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).
No matter how fool-proof your program is, there will always be a better fool.
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
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson My Blog
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
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
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson My Blog
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.
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..
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;
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.
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
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.
If you like my posts, please rate them so I can be somebody!