你在更新前加入
listview.BeginUpdate()
更新
listview.EndUpdate();
这样就不闪了

解决方案 »

  1.   

    你可以观察一下你的机器的cpu占用率。如果它连续1分钟一直都是90%以上的高指标,那么无论如何你的程序的逻辑都是有bug的,可能要求“让每行都实时更新数据”本身就是一个不切实际的要求,它使得你的机器一直在CPU瓶颈中运行。
      

  2.   

     void runLeft()
            {
                Thread s = new Thread(new ThreadStart(LeftListView));
                s.IsBackground = true;
                s.Start();
            }
            public void LeftListView()
            {
                while (true)
                {
                    DataView dv = db.ExecuteDataView("select * from StockTheme order by id asc");
                    if (dv == null) { return; }                listView2.Invoke(new MethodInvoker(delegate() { { listView2.BeginUpdate(); } }));                listView2.Invoke(new MethodInvoker(delegate() { { listView2.Items.Clear(); } }));
                    // listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                    for (int i = 0; i < dv.Count; i++)
                    {
                        listView2.Invoke(new MethodInvoker(delegate() { { listView2.Items.Add(new ListViewItem(new string[] { dv[i]["ID"].ToString(), dv[i]["typename"].ToString(),"-", ThemeNum(dv[i]["id"].ToString()) })); } }));
                    }
                    listView2.Invoke(new MethodInvoker(delegate() { { listView2.EndUpdate(); } }));                Thread.Sleep(1000);
                }
            }这样还是闪啊,我使用一个线程来刷新
      

  3.   

    老大。更新不是这么更新的哇如果你只是改变里面的文本,只要list.item[0].Text=xxxx就可以了
    而不是你上面写的把所有的行都删除了再添加,这样你不刷新才怪。