ListView multiple selection behavior?

后端 未结 1 1501
滥情空心
滥情空心 2021-01-28 06:58

The ListView in Comtl32.dll v6.0 does multiple selection (when using Shift key) as follows (x means selected)

00xxxx
xxxxxx
xxxx00

Earlier vers

相关标签:
1条回答
  • 2021-01-28 07:28

    The short answer is no. But because that seems incomplete...

    The ListView does not expose an API that allows you to change its selection behavior, and as Hans obliquely puts it in his comment, the only way to change the behavior of the ListView control found in versions of comctl32.dll prior to version 6.0 is with a time machine. There's a lot of unique behavior built into the ListView control regarding selection events, so even if you were to try and owner draw the control to modify the appearance of the selection behavior, you'd suddenly be faced with having to handle a nearly ridiculous number of window messages that could potentially cause a selection change.

    It's also worth pointing out that this question is misguided on an entirely different level. If the user of your application is running a version of Windows that includes a version of comctl32.dll prior to version 6.0, this is the behavior that they expect out of the ListView control. Overriding and changing that would be nothing but confusing to them, because it wouldn't work the same way as every other ListView control found on their computer. By contrast, if the user of your application is running a version of Windows that includes comctl32.dll v6 or later, the ListView control will already perform as you describe by default. (And you shouldn't go wanting to change it for exactly the same reasons.)

    0 讨论(0)
提交回复
热议问题