4

I would like to have a way to get the theme colour of the users Windows theme with WPF or C# code-behind. And with this colour I mean the one that can be set in Personalization\Window Color and Appearance under Windows 7(and Vista too, I think). I want to use this colour to make a gradient in much the same way as Trillian 5 does it. enter image description here

I tried to find it myself, but unfortunately I'm not getting anywhere. Apparently it's not under SystemColors.Whatever. I have found something on the MSDN but I can't figure out how to use it, nor do I think it's what I want.

If anyone could help me I would be grateful.

Johan B
  • 890
  • 3
  • 23
  • 39

2 Answers2

5

I think DwmGetColorizationColor (http://msdn.microsoft.com/en-us/library/aa969513.aspx) is what you're looking for; you'll need to P/Invoke.

Mark Sowul
  • 10,244
  • 1
  • 45
  • 51
  • Will this provide the color scheme only, or the Glass effect also? – Chinmoy Mar 10 '11 at 16:29
  • It will provide the glass color selected in the personalization dialog. You may need to rearrange the order though according to this: http://stackoverflow.com/questions/3560890/vista-7-how-to-get-glass-color/3560931#3560931 – Mark Sowul Mar 10 '11 at 16:36
  • Wow. I upvoted and faved that question ages ago and completely forgot about it... – BoltClock Mar 10 '11 at 16:37
  • Thanks! This was what I was looking for. Although a somewhat nicer implementation is preferable, this works just fine. The `ColorizationColor` returns a uint of an hexadecimal, converting that to AARRGGBB values gave me what I needed. – Johan B Mar 10 '11 at 20:07
0

The theme you see on Windows is based on Glass. You have to use a glass in your application to get the same effect.

Chinmoy
  • 1,750
  • 2
  • 21
  • 45