imagenes carga

This commit is contained in:
carlos
2024-02-03 07:22:24 -06:00
parent 1db4c6de84
commit 664ed80cf2
8 changed files with 15 additions and 6 deletions
+13 -4
View File
@@ -28,7 +28,7 @@ namespace compabetov2
private List<Producto> productos; private List<Producto> productos;
public decimal total = 0; public decimal total = 0;
private LoginModel loginPrincipal; private LoginModel loginPrincipal;
private Dictionary<string, Image> imagenes = new Dictionary<string, Image>();
public vender(LoginModel loginPrincipal) public vender(LoginModel loginPrincipal)
@@ -106,11 +106,19 @@ namespace compabetov2
PictureBox pic = new PictureBox(); PictureBox pic = new PictureBox();
pic.Dock = DockStyle.Fill; pic.Dock = DockStyle.Fill;
pic.SizeMode = PictureBoxSizeMode.Zoom; pic.SizeMode = PictureBoxSizeMode.Zoom;
if (imagenes.ContainsKey(producto.img)) {
pic.Image = imagenes[producto.img];
}
else
{
string rutaImg = Path.Combine(Application.StartupPath, "Resources", producto.img); string rutaImg = Path.Combine(Application.StartupPath, "Resources", producto.img);
pic.Image = Image.FromFile(rutaImg);//hay error aquí Image img = Image.FromFile(rutaImg);
pic.Image = img;
imagenes.Add(producto.img, img);
}
//hay error aquí
pic.BackgroundImageLayout = ImageLayout.Stretch; pic.BackgroundImageLayout = ImageLayout.Stretch;
pic.Tag = producto.idProducto; pic.Tag = producto.idProducto;
Label id = new Label(); Label id = new Label();
id.Text = producto.idProducto.ToString(); id.Text = producto.idProducto.ToString();
id.BackColor = Color.FromArgb(82, 82, 82); id.BackColor = Color.FromArgb(82, 82, 82);
@@ -205,7 +213,8 @@ namespace compabetov2
int idProducto = int.Parse(id.Text); int idProducto = int.Parse(id.Text);
decimal precioProducto = producto.precion; decimal precioProducto = producto.precion;
// Generar ticket y agregarlo al flowLayoutPanel2 // Generar ticket y agregarlo al flowLayoutPanel2
GenerarTicket(idProducto, producto.nombre, producto.precion, int.Parse(contador.Text), total, rutaImg); GenerarTicket(idProducto, producto.nombre, producto.precion, int.Parse(contador.Text), total,
Path.Combine(Application.StartupPath, "Resources", producto.img));
}); });
HUD.Controls.Add(btnMenos); HUD.Controls.Add(btnMenos);
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
0aeb254002a0ce305fc1196d5eb6afeb21b30aa751f3290ac831261142a98d95 3f62af869539c2801b7da3577ef2feb00e7c32f1cefc777b57202fa5ad70cc96
Binary file not shown.
Binary file not shown.
Binary file not shown.