imagenes carga
This commit is contained in:
+14
-5
@@ -28,7 +28,7 @@ namespace compabetov2
|
||||
private List<Producto> productos;
|
||||
public decimal total = 0;
|
||||
private LoginModel loginPrincipal;
|
||||
|
||||
private Dictionary<string, Image> imagenes = new Dictionary<string, Image>();
|
||||
|
||||
|
||||
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);
|
||||
|
||||
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.
Reference in New Issue
Block a user