“Always show selection” doesn't work on CListC

2019-07-11 02:13发布

I want a user to be able to select item(s) in my CListCtrl and then click on a button to act on those items. But when the focus is lost from the list, the selection is no longer shown, even if I set 'Always show selection' to true:

enter image description here

enter image description here

This happens both in the dialog test facility, and in my compiled application. I use list-mode, and have no icons, only text.

To reproduce:

  • Create a new dialog in the resource editor
  • Place a list-view control.
  • Set View = List in the properties
  • Set Always Show Selection = True in the properties
  • Add a button to the dialog
  • Press Ctrl-T to test the dialog
  • Select item(s) on the list, then press the button

enter image description here

1条回答
小情绪 Triste *
2楼-- · 2019-07-11 02:44

..and the text is not visibly selected at all. Or is it... I can just barely sort of see some very very faint selection in my screenshot - I think. It's so faint I am not 100% certain it's there!

In addition to my comments: well, there you have it - they are selected, and in a different color, but it seems your screen settings are a bit off. Maybe your color settings, a high contrast mode, or the color setting for selected items in Windows.

The gray color in your screenshot is: #f7f3f7 - light gray, so you might have a problem seeing it, depending on the settings.

An interesting and very lightweight tool to check those things (zoom in, see the color values) is ZoomPlus. I use it every day, and there seems to be source code available too.

查看更多
登录 后发表回答