开发者

how to keep an item focused in c# listview?

i'm trying to keep the last pressed item hi开发者_开发技巧ghlighted in the listview, anyone know how can i do it?


I'm assuming you want to keep the selected item highlighted when the control loses focus.
Then you should check out the HideSelection property.


You can subscribe to the SelectedIndexChanged event and change the selected index/item to the last one.


Looks like you can use ListView::DrawItem for that. Have a look here for an example.


Try looking at the code example here: List view Highlight selected. It shows how to set the foreground/background color of the listview selected item when you change focus away from the listview control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜