private void AddImage(OrderProduct orderProduct) { OrderPanelProductImage productImage = new OrderPanelProductImage(); productImage.OrderProduct = orderProduct; Controls.Add(productImage); }
public void Populate(List <OrderPanelProductImage> imagePanels) { for (var index = 0; index < imagePanels.Count(); index++) { OrderPanelProductImage imagePanel = imagePanels[index]; if (index != 0) { OrderPanelProductImage lastImagePanel = imagePanels[index - 1]; int x = lastImagePanel.Location.X + imagePanel.Width + imagePanel.Margin.Horizontal; int y = lastImagePanel.Location.Y; imagePanel.Location = new System.Drawing.Point(x, y); } else { imagePanel.Location = new System.Drawing.Point(0, 0); } Controls.Add(imagePanel); } }