private void Item_UseThis(object sender, string id) { choice.BackColor = this.BackColor; ItemTow item = (ItemTow)sender; choice = item; models[choiceIndex].used = false; models[int.Parse(id)].used = true; save(); }
private void loadData() { this.modelList.Controls.Clear(); for (int i = 0; i < models.Count; i++) { ItemTow item = new ItemTow(i + ""); if (this.modelList.Controls.Count >= 1) { last = this.modelList.Controls[this.modelList.Controls.Count - 1]; item.Location = new Point(0, last.Location.Y + last.Height); } item.workText.Text = models[i].title; if (models[i].used) { item.BackColor = Color.LightBlue; choice = item; choiceIndex = i; } item.UseThis += Item_UseThis; item.EditWork += Item_EditWork; item.DeleteWork += Item_DeleteWork; this.modelList.Controls.Add(item); } }