Update listview's items and subitems with a timer

前端 未结 2 1244
时光说笑
时光说笑 2020-12-12 04:17

I would like to update some or all of my listview\'s items and subitems contents with a timer (1 second refresh) But the listview flicker each one second. Sometimes the subi

2条回答
  •  醉梦人生
    2020-12-12 04:24

    The ListView control supports double buffering, it maps the DoubleBuffered property to the native control's LVS_EX_DOUBLEBUFFER style flag. It is quite effective but you can't get to it directly since it is a protected property. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form, replacing the old one.

    using System;
    using System.Windows.Forms;
    
    class BufferedListView : ListView {
        public BufferedListView() {
            this.DoubleBuffered = true;
        }
    }
    

提交回复
热议问题