private void ShowDeckList(CardDescription[] Cards, VirtualListView listview) { ListViewItem[] resultItem = new ListViewItem[Cards.Length]; for (int i = 0; i < Cards.Length; i++) { CardDescription card = Cards[i]; bool largeicon = false; if (listViewEx1.View == View.LargeIcon) { largeicon = true; } resultItem[i] = ListViewItemFactory.GetItemByCard(card, largeicon); } listview.BeginUpdate(); if (listview.VirtualMode) { View v = listview.View; listview.View = View.List; listview.VirtualListSize = Cards.Length; listview.View = v; } else { listview.Items.Clear(); listview.Items.AddRange(resultItem); } listview.EndUpdate(); }
private void ShowDeckList(CardDescription[] Cards, VirtualListView listview) { ListViewItem[] resultItem = new ListViewItem[Cards.Length]; for (int i = 0; i < Cards.Length; i++) { CardDescription card = Cards[i]; ListViewItem tmpItem = new ListViewItem(); tmpItem.Text = card.name; //tmpItem.UseItemStyleForSubItems = false; Color color = tmpItem.ForeColor; switch (card.iCardtype) { case 0: color = Color.OrangeRed; break; case 4: color = Color.Green; break; case 5: color = Color.Fuchsia; break; case 1: color = Color.SandyBrown; break; case 2: color = Color.DarkOrchid; break; case 3: color = Color.DodgerBlue; break; case 6: color = Color.DarkSlateGray; break; } tmpItem.ForeColor = color; tmpItem.SubItems.Add(card.japName); tmpItem.SubItems.Add(card.sCardType); tmpItem.SubItems.Add(card.tribe); tmpItem.SubItems.Add(card.element); if (card.level > 0) { tmpItem.SubItems.Add(card.level.ToString()); } else { tmpItem.SubItems.Add(""); } tmpItem.SubItems.Add(card.atk); tmpItem.SubItems.Add(card.def); tmpItem.SubItems.Add(card.ID.ToString()); if (!listview.VirtualMode) { if (listview.View == View.Details) { tmpItem.ImageIndex = card.iCardtype; } else { tmpItem.ImageIndex = Global.largePicLoader.GetImageIndex(card.ID); } } //listView1.Items.Add(tmpItem); resultItem[i] = tmpItem; } listview.BeginUpdate(); if (listview.VirtualMode) { View v = listview.View; listview.View = View.List; listview.VirtualListSize = Cards.Length; listview.View = v; } else { listview.Items.Clear(); listview.Items.AddRange(resultItem); } listview.EndUpdate(); }