日期:2014-05-20  浏览次数:20682 次

listview 显示大容量数据的时候,出现假死
listview 显示大容量数据的时候,出现假死,现在有111191条数据需要显示在listview 上面,
代码如下:
if (ht != null)
            {
                if (ht.Count > 0)
                {
                    if (string.IsNullOrEmpty(txtItemID.Text.Trim()))
                    {
                        MessageBox.Show("请输入道具编号!");
                        return;
                    }

                    lblTotalDataNum.Text = ht.Count.ToString();
                    lvwItem.Visible = false;

                    if (ht.ContainsKey(ItemID))
                    {
                        Hashtable temp = (Hashtable)ht[ItemID];
                        foreach (DictionaryEntry de in temp)
                        {
                            ListViewItem item = new ListViewItem(ItemID.ToString());  //道具编号
                            item.SubItems.Add(ItemDB.Instance.GetItemName(ItemID));   //道具名称
                            item.SubItems.Add(de.Value.ToString());                   //道具数量
                            item.SubItems.Add(de.Key.ToString());                   //角色名称
                            lvwItem.Items.Add(item);
                        }
                    }