public FormGameItem(Item item) { InitializeComponent(); _item = (GameItem)item; labelName.Text += _item.Name; labelWear.Text += _item.Wear; labelQuality.Text += _item.Rarity; }
void listBoxReceave_DrawItem(object sender, DrawItemEventArgs e) { if (e.Index < 0) { return; } e.DrawBackground(); e.DrawFocusRectangle(); Color c = Color.Gray; GameItem selectedItem = null; if (listBoxReceave.Items[e.Index].GetType().Name == "GameItem") { selectedItem = (GameItem)listBoxReceave.Items[e.Index]; c = selectedItem.Color; } e.Graphics.DrawString(listBoxReceave.Items[e.Index].ToString(), new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold), new SolidBrush(c), e.Bounds); }
private void refreshListings() { listView1.Items.Clear(); _availableListings.Sort((a, b) => a.Price.CompareTo(b.Price)); foreach (Listing v in _availableListings) { if (v.Item.Name.StartsWith(textBoxSearch.Text)) { GameItem item = (GameItem)v.Item; listView1.Items.Add(new ListViewItem( new string[] { v.ID.ToString(), item.Name, item.Rarity.ToString(), item.Wear.ToString(), _users[v.UserID].Name, v.Price.ToString() })); } } }