Windows窗体 - 非活动突出显示颜色 [英] Windows forms - inactive highlight color

查看:171
本文介绍了Windows窗体 - 非活动突出显示颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ListView 控制与 OwnerDraw = true




  • 有时候我的控制可能不会集中,但是选择了项目。


  • 我找不到任何指南,普通的 ListView 使用 SystemColors.Control 颜色表示(见图片)。



    >



  • >

    解决方案

    SystemColors.Control 是正确的颜色。不幸的是,在 SystemColors 中没有为非活动项目预定义 Color ,这使得它是显而易见的,但它是可靠的。 / p>

    当你不能依赖 SystemColors 时,只有当用户对Windows中的主题颜色设置做出明确的修改时。但是,您不应该关心这一点,因为它是一个明确的用户选择,并且您不应该干扰用户的选择。



    至于指南,Windows UX准则没有明确为非活动项目指定适当的颜色,但它会强调选择与操作系统一致的颜色,提供良好的对比度和易读性。



    在应用程序中没有太担心的外观和感觉,我使用默认系统颜色,但如果我是主题我自己的应用程序(例如看起来像Visual Studio),我完全避免系统颜色,并使用web颜色代替。



    希望这有帮助。


    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 the SystemColors.Control color for that (see the picture).

    • Could I rely on that or would that be incorrect for some cases?

    解决方案

    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.

    这篇关于Windows窗体 - 非活动突出显示颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆