问题
I have a ListView
control with OwnerDraw = true
.
Sometimes my control might not be focused, but have the items selected. Which color should I use to render the selection bar?
I couldn't find any guidelines for that, however, it seems that the ordinary
ListView
uses theSystemColors.Control
color for that (see the picture).Could I rely on that or would that be incorrect for some cases?
回答1:
SystemColors.Control
is the correct color to use. Unfortunately there is not a predefined Color
in SystemColors
for an inactive item that makes it obvious, but it is reliable.
The only time you cannot rely on SystemColors
is when a user makes explicit changes to the theme color settings in Windows. However, you should not care about that because its an explicit user choice, and you should not interfere with user choices.
As for guidelines, the Windows UX Guidelines do not explicitly state the appropriate color to use for inactive items, but it does stress choosing colors consistant with the operating system that provide good contrast and easy readability.
In applications that I'm not too worried about the look and feel for, I use default system colors, but if I am theming my own application (eg. to look like Visual Studio for example), I avoid system colors altogether and use web colors instead.
Hope this helped.
来源:https://stackoverflow.com/questions/10428710/windows-forms-inactive-highlight-color