private void AddOrder(Order order) { OrderPanel orderPanel = new OrderPanel(); orderPanel.Order = order; orderPanel.Name = "OrderPanel" + order.ID.ToString(); Controls.Add(orderPanel); }
public void Populate(List <OrderPanel> orderPanels) { for (var index = 0; index < orderPanels.Count(); index++) { OrderPanel orderPanel = orderPanels[index]; if (index != 0) { OrderPanel lastCartProductPanel = orderPanels[index - 1]; int x = lastCartProductPanel.Location.X; int y = lastCartProductPanel.Location.Y + orderPanel.Height + orderPanel.Margin.Vertical; orderPanel.Location = new System.Drawing.Point(x, y); } else { orderPanel.Location = new System.Drawing.Point(0, 0); } Controls.Add(orderPanel); } }