Getting the color value of TaskDialog Main Instruction text
-
14-11-2019 - |
문제
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?
해결책
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.
다른 팁
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).