| Perfil de MambyDevNationBlogListas | Ayuda |
DevNationWelcome to the Developer Nation ! |
||||||
|
05 julio WPF HighContrast (High contrast support with Windows Presentation Foundation)
I hate the literature, but I know that’s necessary for a blog. Lets go to the practice !!! Many applications have enhanced UI (User Interface) but doesn’t support all high contrast color schemes. Two examples: Example 1. Microsoft Office 2007 applications in High Contrast #2 color scheme: Example 2. Windows live applications in all high contrast color schemes:
Demo: You can create similar UIs with WPF (Windows Presentation Foundation) while fully supporting high contrast color schemes. The approach that I used isn't, maybe, the best practical one but can be used as starting point to solve this problem. The sample application support all system’s default high contrast color schemes (black, white, #1 and #2) and can be easily extended. Code: (Main function) public static bool IsHighContrast() { bool isHighContrast = false; if (SystemColors.ControlColor.ToString() == "#FF000000") { if (SystemColors.ControlTextColor.ToString() == "#FFFFFFFF" || SystemColors.ControlTextColor.ToString() == "#FF00FF00") // High Contrast #1, #2 and Black. { isHighContrast = true; } else { isHighContrast = false; } } else if (SystemColors.ControlColor.ToString() == "#FFFFFFFF") { if (SystemColors.ControlTextColor.ToString() == "#FF000000") // High Contrast White. { isHighContrast = true; } else { isHighContrast = false; } } return isHighContrast; } Download source code (zip): WPF HighContrast.zip |
|||||
|
|