设置
listView1.VirtualMode = true;
listView1.RetrieveVirtualItem += ListView1_RetrieveVirtualItem;
private void ListView1_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
{
e.Item = MyListView[e.ItemIndex];
}
List<ListViewItem> ListView = new List<ListViewItem>();
ListViewItem item = new ListViewItem();
item.Text = i.ToString();
item.SubItems.Add(temp[0]);
item.SubItems.Add(temp[1]);
item.SubItems.Add(temp[2]);
item.SubItems.Add(temp[3]);
item.SubItems.Add("等待任务");
ListView.Add(item);
this.Invoke(new EventHandler(delegate
{
listView1.VirtualListSize = MyListView.Count;
listView1.Invalidate();
}));
//滚动listview
this.Invoke(new EventHandler(delegate
{
MyListView[Listview_index].EnsureVisible();
}));
System.Threading.Interlocked.Increment(ref NowThread);