ListView的多个选择行为? [英] ListView multiple selection behavior?

查看:126
本文介绍了ListView的多个选择行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Comtl32.dll v6.0中的ListView进行多项选择(使用Shift键时),如下所示(x表示已选中)

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

00xxxx
xxxxxx
xxxx00

ListView的早期版本执行以下操作:

Earlier versions of ListView do it as follows :

00xx00
00xx00
00xx00

有什么办法让它做第一种方法(comctl32 v6.0方法)?

Is there any way to have it do the first way (the comctl32 v6.0 way)?

感谢约翰

推荐答案

简短的回答是否".但是,因为这似乎不完整...

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

ListView不会公开允许您更改其选择行为的API,正如汉斯(Hans)倾斜地将其添加到他的注释中一样,这是更改comctl32版本中的ListView控件行为的唯一方法. 6.0版之前的dll与时间机器配合使用. ListView控件中内置了许多与选择事件有关的独特行为,因此,即使您尝试和所有者绘制该控件来修改选择行为的外观,您也会突然面对不得不处理近乎荒谬的可能会导致选择更改的窗口消息.

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.

也有必要指出,这个问题在完全不同的层面上被误导了.如果您的应用程序用户正在运行Windows版本,其中包括版本6.0之前的comctl32.dll版本,则这是他们期望的行为, 来自ListView控件.覆盖和更改这些内容只会让他们感到困惑,因为它们的工作方式不同于他们计算机上找到的所有其他ListView控件.相比之下,如果应用程序的用户运行的Windows版本包含comctl32.dll v6或更高版本,则默认情况下ListView控件将已经执行. (而且您不应该出于完全相同的原因而希望对其进行更改.)

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.)

这篇关于ListView的多个选择行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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