/// <summary> /// This method load all drinks to the listViewBebidas /// </summary> public void cargarBebidas() { List <Refresco> listaBebidas = cp.listarRefrescos(); foreach (Refresco r in listaBebidas) { listViewBebidas.Items.Add(r.getNombre()); } }
private void loadBebidas() { List <Refresco> listaRefrescos = cp.listarRefrescos(); int x = 40; int y = 0; try { if (listaRefrescos != null) { for (int i = 0; i < listaRefrescos.Count; i++) { String pathimg = listaRefrescos[i].getImagen(); PictureBox pb = new PictureBox(); pb.Name = listaRefrescos[i].getNombre(); pb.Width = 100; pb.Height = 100; pb.ImageLocation = "http://provenapps.cat/~dam1804/Images/bebidas/" + pathimg; pb.BorderStyle = BorderStyle.None; pb.BackColor = Color.White; pb.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; pb.Click += new System.EventHandler(this.pressedBebida); if (i != 0) { y += 169; } pb.Location = new Point(x, y); panelBebidas.Controls.Add(pb); } } } catch (Exception ex) { } }