简体   繁体   English

在 ListView 中突出显示一个选项

[英]Highlight an option in the ListView

I created a ListView programmatically.我以编程方式创建了一个 ListView。 I set the FullRowSelect option as true.我将 FullRowSelect 选项设置为 true。 After adding the elements to the ListView, if I start selecting the items, the row which is currently selected is highlighted with a blue color.将元素添加到 ListView 后,如果我开始选择项目,当前选择的行将以蓝色突出显示。 How can I disable the highlighting?如何禁用突出显示? I want to stop the highlighting of an item on its selection, but want FullRowSelect to be true.我想停止突出显示其选择的项目,但希望 FullRowSelect 为真。

Also, if I select an item, I want to change the color of the item so that anyone can easily identify which item is selected.另外,如果我 select 一个项目,我想更改项目的颜色,以便任何人都可以轻松识别选择了哪个项目。

The only way to really control the display of items in a list is to use ownerdraw.真正控制列表中项目显示的唯一方法是使用 ownerdraw。 This approach is not exposed in .NET, so will mean overriding the creation and WinProc of the list (at least).此方法未在 .NET 中公开,因此将意味着覆盖列表的创建和 WinProc(至少)。

Another option might be WPF, much of the styling of controls being overridable.另一个选项可能是 WPF,控件的大部分样式都是可覆盖的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM