Cada vez más cercas del final

This commit is contained in:
Michael Robles
2024-01-08 14:55:34 -07:00
parent 6c31379042
commit 9303edc799
19 changed files with 303 additions and 205 deletions
+26 -4
View File
@@ -98,15 +98,32 @@ namespace compabetov2
btnMenos.FlatStyle = FlatStyle.Flat;
btnMenos.FlatAppearance.BorderSize = 0;
btnMenos.BackColor = Color.FromArgb(33, 90, 255);
// Agregar esquinas redondeadas al botón
System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
gp.AddEllipse(0, 0, btnMenos.Width, btnMenos.Height);
btnMenos.Region = new Region(gp);
btnMenos.Click += new EventHandler(delegate (object sender, EventArgs e)
{
int numeroContador = int.Parse(contador.Text.ToString());
contador.Text = (numeroContador - 1).ToString();
total -= producto.precion;
// Validar que el contador no sea 0 antes de restar
if (numeroContador > 0)
{
contador.Text = (numeroContador - 1).ToString();
total -= producto.precion;
}
else
{
// Mostrar mensaje de advertencia
MessageBox.Show("No puedes vender cosas negativas", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
});
Button btnMas = new Button();
btnMas.Text = "+";
btnMas.Width = 25;
@@ -170,8 +187,13 @@ namespace compabetov2
{
}
private void button1_Click(object sender, EventArgs e)
{
MenuPrincipal menuPrincipal = new MenuPrincipal();
menuPrincipal.Show();
this.Dispose(true);
}
}
}