public void RemoveTempNumber(int Number) { if (TempNumbers.Any(a => a.Number == Number)) { Controls.Remove(TempNumbers.Where(a => a.Number == Number).First().Control); TempNumbers.Remove(TempNumbers.Where(a => a.Number == Number).First()); } }
public void ResetTempNumbers() { TempNumbers.Clear(); Label[] labels = Controls.OfType <Label>().ToArray(); foreach (Label lb in labels) { Controls.Remove(lb); } }
public void RemoveTempNumber(int[] Numbers) { foreach (int num in Numbers) { if (TempNumbers.Any(a => a.Number == num)) { Controls.Remove(TempNumbers.Where(a => a.Number == num).First().Control); TempNumbers.Remove(TempNumbers.Where(a => a.Number == num).First()); } } }
private void _AddTempNumber(int Number) { if (TempNumbers.Any(a => a.Number == Number)) { RemoveTempNumber(Number); return; } if (Number == 0) { ResetTempNumbers(); return; } ResetNumber(); Label lb = new Label(); Controls.Add(lb); lb.Font = new Font("BlowBrush", 8, FontStyle.Regular); lb.Text = Number.ToString(); lb.AutoSize = true; SetEvent(lb); switch (Number) { case 1: lb.Location = new Point(3, 2); break; case 2: lb.Location = new Point(18, 2); break; case 3: lb.Location = new Point(33, 2); break; case 4: lb.Location = new Point(3, 17); break; case 5: lb.Location = new Point(18, 17); break; case 6: lb.Location = new Point(33, 17); break; case 7: lb.Location = new Point(3, 32); break; case 8: lb.Location = new Point(18, 32); break; case 9: lb.Location = new Point(33, 32); break; default: break; } TempNumbers.Add(new CageTempNum(lb, Number)); }