diff --git a/Ventas/vender.cs b/Ventas/vender.cs index e9ba3ef..20eef80 100644 --- a/Ventas/vender.cs +++ b/Ventas/vender.cs @@ -28,7 +28,7 @@ namespace compabetov2 private List productos; public decimal total = 0; private LoginModel loginPrincipal; - + private Dictionary imagenes = new Dictionary(); public vender(LoginModel loginPrincipal) @@ -106,11 +106,19 @@ namespace compabetov2 PictureBox pic = new PictureBox(); pic.Dock = DockStyle.Fill; pic.SizeMode = PictureBoxSizeMode.Zoom; - string rutaImg = Path.Combine(Application.StartupPath, "Resources", producto.img); - pic.Image = Image.FromFile(rutaImg);//hay error aquí + if (imagenes.ContainsKey(producto.img)) { + pic.Image = imagenes[producto.img]; + } + else + { + string rutaImg = Path.Combine(Application.StartupPath, "Resources", producto.img); + Image img = Image.FromFile(rutaImg); + pic.Image = img; + imagenes.Add(producto.img, img); + } + //hay error aquí pic.BackgroundImageLayout = ImageLayout.Stretch; pic.Tag = producto.idProducto; - Label id = new Label(); id.Text = producto.idProducto.ToString(); id.BackColor = Color.FromArgb(82, 82, 82); @@ -205,7 +213,8 @@ namespace compabetov2 int idProducto = int.Parse(id.Text); decimal precioProducto = producto.precion; // 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); diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index 8718b0e..9d161e8 100644 Binary files a/bin/Debug/compabetov2.exe and b/bin/Debug/compabetov2.exe differ diff --git a/bin/Debug/compabetov2.pdb b/bin/Debug/compabetov2.pdb index bab39a4..e83aba9 100644 Binary files a/bin/Debug/compabetov2.pdb and b/bin/Debug/compabetov2.pdb differ diff --git a/obj/Debug/compabetov2.csproj.AssemblyReference.cache b/obj/Debug/compabetov2.csproj.AssemblyReference.cache index a853f99..e1562b1 100644 Binary files a/obj/Debug/compabetov2.csproj.AssemblyReference.cache and b/obj/Debug/compabetov2.csproj.AssemblyReference.cache differ diff --git a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache index 654a195..f3a1c49 100644 --- a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache +++ b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -0aeb254002a0ce305fc1196d5eb6afeb21b30aa751f3290ac831261142a98d95 +3f62af869539c2801b7da3577ef2feb00e7c32f1cefc777b57202fa5ad70cc96 diff --git a/obj/Debug/compabetov2.csproj.GenerateResource.cache b/obj/Debug/compabetov2.csproj.GenerateResource.cache index 96ec853..ace18c5 100644 Binary files a/obj/Debug/compabetov2.csproj.GenerateResource.cache and b/obj/Debug/compabetov2.csproj.GenerateResource.cache differ diff --git a/obj/Debug/compabetov2.exe b/obj/Debug/compabetov2.exe index 8718b0e..9d161e8 100644 Binary files a/obj/Debug/compabetov2.exe and b/obj/Debug/compabetov2.exe differ diff --git a/obj/Debug/compabetov2.pdb b/obj/Debug/compabetov2.pdb index bab39a4..e83aba9 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ