Disabling progress bar animation on Vista Aero
Asked Answered
A

5

9

I'm using a Delphi 2009 VCL TProgressBar as a kind of "empty/full" gauge.

On Vista, with Aero theme enabled, this has an animation associated with it, which is annoying and inappropriate for an gauge.

Is there any way of disabling this (NOT by adjusting user's theme settings!) to prevent the animation on this control?

To clarify, I want something basically identical to the 'disk space used' meters in Windows Explorer. No animation, but still with a nice border and shading effects.

Update:

I understand that I need a "meter", rather than a true progress bar. How can a themed meter be implemented using the standard windows progress bar control?

Ampere answered 24/11, 2008 at 9:57 Comment(0)
W
11

As per the Vista UI guidelines for progress bars you should not be using a TProgressBar for such purposes at all, it states:

Use progress bars only for progress. Use meters to indicate percentages that aren't related to progress.

There are a lot of Third-Party components (for example Abakus VCL) that are aimed at Process Automation applications and the like, maybe you could use one of these controls instead?

Wharf answered 24/11, 2008 at 15:8 Comment(5)
Understood - but it says: "Meters: This pattern isn't a progress bar, but it is implemented using the progress bar control." How can I implement such a "Meter" using the progress bar control? As for the Abakus components, my application should look like it was designed in the last ten years or so.Ampere
I don't know how to implement the meter, and don't have Vista here to check. Could you run Spy++ and have a look at the Windows style flags that are set for those meter controls? Spy++ comes with MS Visual C++. Google for "spy++ freeware" if you don't have it.Wharf
As for Abakus - I hear you ;-) If you need the gauge to look good in Vista it would of course be best to find a style for the common control. I just don't find anything in the Platform SDK... Check out msdn.microsoft.com/en-us/library/cc656530(VS.85).aspx for the available docu.Wharf
I did not find anything else regarding those "meter" controls. There is of course also the alternative of creating a TGraphicControl. Code for how to draw Vista-style progress bars using GDI+ can be found for example at codeproject.com/KB/cpp/VistaProgressBar.aspxWharf
+1 because i think this is the correct answer. A battery does not drain or charge fast enough for the animation to be visible. A car does not burn gas, or get filled up, fast enough to make the animation important. The only example i can imagine is a CPU load, or fan speed indicator. In the end, i would think you're probably going to be forced to use a custom control (with UxTheme API drawing applied)Rother
H
10

You can try turning themes off for that control;

SetWindowTheme(ProgressBar.Handle, ' ', ' ');
Haruspex answered 24/11, 2008 at 22:33 Comment(3)
+1 because this answer seems useful - although i have no idea if it works, or is the correct way to intentionally disable themeing on a Common Control.Rother
i have tested this and it works, the function is in the library UxTheme (msdn.microsoft.com/en-us/library/bb759827(VS.85).aspx)Braswell
Yes and no. It turns off the animation BUT it also turns off all theming of the control, so you just get a solid blue box without border, shading, or any other UI beautification. My objective is to get something matching the 'disk space used' meters in explorer.Ampere
H
3

Try the VistaProBar at http://rmklever.com/ It does NOT have animation associated with it.

Hellen answered 5/5, 2011 at 16:20 Comment(0)
A
1

I haven't tried it yet, but this question looks to have a useful answer for winforms.

How can I use a meter-style progress bar?

Now to convert it to Delphi...

Ampere answered 5/5, 2011 at 13:41 Comment(0)
W
0

Have a look at this forum thread. It is the only promising link I found, and the first posting mentions the different progress bar states, so changing the properties Smooth, State and Style will probably not help.

If the the tip in the last posting is indeed the only way to draw the progress bar in meter style, then your best option is to create a descendent class of TProgressBar, override the WM_PAINT handler, check for Vista and enabled themes, and in that case use the functions in UxTheme to paint the different parts of the control.

Wharf answered 24/11, 2008 at 21:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.