如何更改“概述”的项目在列表框中而不更改选择?
如何更改列表框中“概述”的项目?请参阅以下屏幕截图以了解详情:
背景: 我想要一个正常工作的标准多选列表框。不幸的是,Windows 窗体列表框(带有 SelectionMode.MultiExtended
)的功能并不完整。缺少的功能是它不允许您使用 Ctrl+箭头键和 Ctrl+空格键选择一组不相交的项目。 (在 Windows 资源管理器中尝试一下,看看它应该如何工作。)我正在尝试子类化 ListBox 并添加这个缺失的功能。为此,我打算在 OnKeyDown
受保护方法中响应 Ctrl+箭头键,但为了做到这一点,我需要能够在不更改所选项目集的情况下移动轮廓。我该怎么做?
How do you change which item is “outlined” in a ListBox? See the following screenshot for clarification:
Background: I want to have a standard multi-select listbox that works normally. Unfortunately, the Windows Forms ListBox (with SelectionMode.MultiExtended
) is not fully functional. The missing functionality is that it doesn’t let you select a disjoint set of items by using Ctrl+Arrow keys and Ctrl+Space. (Try it in Windows Explorer to see how it’s supposed to work.) I am trying to subclass ListBox and add this missing functionality. To this end, I intend to respond to Ctrl+Arrow keys in the OnKeyDown
protected method, but in order to do so, I need to be able to move the outline without changing the set of selected items. How do I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过将 LB_SETCARETINDEX 消息发送到列表框来完成此操作:
You can do this by sending the LB_SETCARETINDEX message to the list box: