简体   繁体   中英

In C#, how do I highlight selected item in a listview?

In c# winforms, I have a listview with some images. The user can select one image, but when he leavs the listview i need to keep highlighting the item that he selected. also, when the form is open, the data of the form is loaded from the DB. One data is the name of the image in the listview, I need to highlight the image that was loaded from the DB.

尝试将ListView.HideSelection属性设置为false。

ListView.HideSelection set to false will override color on selected items. If you want keep HideSelection set to false and show hightlight, you only can change it font.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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