方法:开启ListView双缓存
1.自定义一个类CustomListView,继承自 System.Windows.Forms.ListView
public CustomListView()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
UpdateStyles();
}
2.修改Form设计器代码中定义ListView的位置
private System.Windows.Forms.Button button1;
//private System.Windows.Forms.ListView listView1;
private CustomListView listView1;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader4;
3.修改Form设计器代码中实例化ListView类的位置
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button();
//this.listView1 = new System.Windows.Forms.ListView();
this.listView1 = new CustomListView();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.SuspendLayout();