views:

460

answers:

4

Windows 7 taskbar buttons are drawn on a shaded background. The color shade somehow reacts on where the mouse is over the button.

I'd like to use such buttons in my application. How can i do that ?

A: 

I believe they're implemented as shader programs on the GPU. Just a simple program which takes the cursor position, and computes a brightness for each pixel based on the distance from that position.

jalf
If I remember correctly, they work in a VM with non-WDDM drivers, so there should also be a software algorithm.
OregonGhost
They do? I thought they were disabled when Aero Glass is off. Anyway, the algorithm is the same if you do it in software. Just slower.
jalf
+1  A: 

Perhaps try

DrawThemeBackground

http://msdn.microsoft.com/en-us/library/bb773289%28VS.85%29.aspx

Give it the BS_PUSHBUTTON constant. I've used this in Windows XP to draw the plush blue XP themed controls, but not in Aero, but it's worth a try.

karoberts
Thanks although not the solution, this is a great hint. I have 2 or three places were i tried to draw button like objects my own. Using DrawThemeBackground i can get it done by Windows in the original way.
RED SOFT ADAIR
A: 

It uses the new animation api (Some of it exists in Vista, extended in 7) There is no magic style to set, you still need to do the drawing on your own

Anders
Any source code for this?
RED SOFT ADAIR
+1  A: 

The effect is called "Color Hot-track". It does not seem that there is a dedicated API for that. There are some notes in a developer blog about it:

I found some source code from Rudi Grobler though doing a similar thing:

Make your WPF buttons color hot-track!

RED SOFT ADAIR