private void AddButton_Click(object sender, EventArgs e) { if (int.TryParse(AddTextBox.Text, out int value)) { var item = new SortedItem(value, items.Count); items.Add(item); this.panel3.Controls.Add(item.ProgressBar); this.panel3.Controls.Add(item.Label); } AddTextBox.Clear(); }
public List <SortedItem> DisplayList(List <SortedItem> list) { List <SortedItem> NewList = new List <SortedItem>(); for (int i = 0; i < list.Count; i++) { var item = new SortedItem(list[i].Value, i); this.panel4.Controls.Add(item.ProgressBar); this.panel4.Controls.Add(item.Label); NewList.Add(item); } return(NewList); }
private void FillButton_Click(object sender, EventArgs e) { panel3.Controls.Clear(); items = new List <SortedItem>(); if (int.TryParse(FillTextBox.Text, out int value)) { var rnd = new Random(); for (int i = 0; i < value; i++) { var item = new SortedItem(rnd.Next(0, 100), items.Count); items.Add(item); this.panel3.Controls.Add(item.ProgressBar); this.panel3.Controls.Add(item.Label); } } FillTextBox.Clear(); }