public partial class Form1 : Form ...{
class DoubleBufferListView : ListView
...{
public DoubleBufferListView()
...{
SetStyle(ControlStyles.DoubleBuffer|ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
UpdateStyles();
}
}
public Form1()
...{
InitializeComponent();
}
DoubleBufferListView lv = new DoubleBufferListView();
private void Form1_Load(object sender, EventArgs e)
...{
this.Controls.Add(lv);
lv.Height = 300;
lv.Width = 300;
new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(doAdd)).Start();
}
void doAdd(object obj)
...{
if (this.InvokeRequired)
...{
this.Invoke(new System.Action<object>(doAdd), new object[] ...{ obj });
}
else
...{
for (int i = 0; i < 100; i++)
...{
this.lv.Items.Add(new ListViewItem("jinjazz" + this.lv.Items.Count.ToString()));
System.Threading.Thread.Sleep(10);
Application.DoEvents();
}
}
}
}