protected override void OnPaint(PaintEventArgs pe) { int nowID = HackFunctions.getItemType(Number); if (lastID != nowID) { var img = MainForm.item_images.Images["Item_" + nowID]; if (img != null) { Graphics g = Graphics.FromImage(img); Image newImg = (Image)img.Clone(); g.DrawImage(newImg, 0, 0); this.Image = newImg; g.Dispose(); Tip.SetToolTip(this, MainForm.resource.Items.First(i => i.id == nowID).name); } else { Tip.SetToolTip(this, ""); } this.lastID = nowID; } base.OnPaint(pe); pe.Graphics.DrawString(HackFunctions.getItemStack(Number).ToString(), new Font("Arial", 10), new SolidBrush(Color.Black), 10, 35); if (Selected) { pe.Graphics.DrawRectangle(new Pen(Color.BlueViolet, 3), 1, 1, pe.ClipRectangle.Width - 3, pe.ClipRectangle.Height - 3); } }