简体   繁体   English

C# 如何刷新列表视图

[英]C# How to refresh a listview

I've writtent the following code :我写了以下代码:

this.listView1.Items[i].BackColor = Color.Orange;

I would like to know how can I refresh my listview so I can see in real time the updated listview.我想知道如何刷新我的列表视图,以便实时查看更新后的列表视图。 Thanks.谢谢。

Normally you should not do anything special, and ListView will be redrawn itself when you're changing item's backcolor.通常你不应该做任何特别的事情,当你改变项目的背景色时,ListView 会被重绘。

But anyway, you can use listView1.Refresh();但无论如何,你可以使用listView1.Refresh(); to force its redrawing.强制重绘。

请尝试以下操作:

 listView1.Items.Clear();

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

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