private void UserFood_Click(object sender, EventArgs e) { UCMonAn user = sender as UCMonAn; if (user.Choose) { listCount[user.K] = user.CountFood; load(); user.Choose = false; } }
public void CreateUser(Panel Order) { Order.Controls.Clear(); Point P = new Point(0, 20); for (int i = 0; i < listFood.Count; i++) { if (listFood[i].Status == "Yes") { UCMonAn UserFood = new UCMonAn(listFood[i].Name, listFood[i].Price.Value, listFood[i].Sale.Value, listFood[i].ID_Food.ToString()) { Location = P }; UserFood.K = i; UserFood.changeNumberUpDown(listCount[i]); listUser.Add(UserFood); UserFood.Click += UserFood_Click; P.X = 0; P.Y = P.Y + 150; Order.Controls.Add(UserFood); } } System.GC.Collect(); }