8

The TaskDialog in Windows7 has a blue Main Instruction text at the top. Is there a way to get that color as a Brush value in WPF?

5
  • 1
    How about cutting edge tech like the eyedropper in mspaint?
    – brunnerh
    Commented May 15, 2011 at 17:51
  • @H.B. That will usually give you the wrong value due to antialiasing and blending.
    – Josh
    Commented May 15, 2011 at 17:54
  • @Josh Einstein: The font is rather big though, it might be possible to find a solid pixel in it.
    – brunnerh
    Commented May 15, 2011 at 17:58
  • @H.B. that will only give you a rough estimate on the colour on your current system. It will completely break with other theme colours, high contrast themes etc. Do not hardcode colours but try to get them from the framework/OS whenever possible.
    – urbanhusky
    Commented Mar 3, 2015 at 9:42
  • @brunnerh Hardcoding the text color will fall over dead when the Windows color scheme changes. Rather than follow your suggestion, we want to be good developers.
    – Ian Boyd
    Commented Feb 10 at 17:14

2 Answers 2

9

These colors are actually defined in the Windows User Experience Interaction Guidelines. As far as I know they are not available as named system colors, but the guide explicitly lists the RGB colors and font sizes for the various text elements.

0
2

I've written about this here: http://blog.quppa.net/2011/04/30/windows-theme-fonts/

In short, no, there is no support in WPF for retrieving the font size/colour/etc. of theme parts, but there is in Win32 with the GetThemeFont and GetThemeColor functions. These will only work when visual styles are enabled, however, and you will need to hard-code fallback values when Windows Classic or the High-Contrast themes are in use. In the case of 'Main Instruction' text, you should use the caption font (mercifully this is accessible through WPF).

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.