3

How to programmatically get the bar color and the background color of TProgressBar control with Windows Aero feature enabled?

I'm using a third party progress bar control, not the default one which comes with Delphi and I'm trying to paint the control with the right colors.

I use Delphi 2010.

The_Fox
  • 6,992
  • 2
  • 43
  • 69
Ariel Rivas
  • 154
  • 1
  • 5
  • 4
    I don't think the progress bar is a single color.It's drawn with some pretty gradients. You want a particular average color? It still won't look like the aero theme. Maybe you want to know how to extend the third party control so it can be aware of, and draw itself with themes? – Warren P Jun 29 '11 at 00:47
  • 4
    Warren is right. There is no "the bar color". The one that "comes with Delphi" is actually a native Windows progress bar control (in fact, most components that come with Delphi, such as `TEdit`, `TButton`, `TMemo`, `TRichEdit`, `TListBox`, `TImageList`, etc. are only wrappers for the native controls/objects). What is the problem with the standard Windows control?. If you need a custom control, it is very easy to use the theme services API to draw the current theme's progress bar parts. – Andreas Rejbrand Jun 29 '11 at 00:51
  • See my answer [here](http://stackoverflow.com/questions/2191301/how-can-i-get-the-color-for-a-themed-tabsheet) and [this question](http://stackoverflow.com/questions/6177889/how-to-determine-windows-theme-tcolors). – Uli Gerhardt Jun 29 '11 at 07:22
  • 2
    I'm very curious. Why would you use a 3rd party progress bar control? What does it offer over and above the standard system control? – David Heffernan Jun 29 '11 at 08:46
  • Inability to support Aero themes. :-) Ironic, yes? – Warren P Jun 29 '11 at 12:52

1 Answers1

7

Options, in order of most sensible for beginners to least sensible for beginners:

(1) Take out the third party progress bar, and put in a regular one. (Beginner, and smart old guy solution, ironically the same)

(2) Get a skinning/theming pack, and make it draw the way you want. (Intermediate)

(3) Learn to use the Themes and UxThemes units to extend your custom control. (Advanced)

After you've had enough pain from #2, and #3, you'll head back to #1, and the crusty (wise) old timer in you would make the same decision as the rank amateur.

Warren P
  • 65,725
  • 40
  • 181
  • 316