diff --git a/MenuPrincipal.Designer.cs b/MenuPrincipal.Designer.cs index b0eae95..7a6f203 100644 --- a/MenuPrincipal.Designer.cs +++ b/MenuPrincipal.Designer.cs @@ -77,9 +77,9 @@ this.panel1.Controls.Add(this.pictureBox1); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Margin = new System.Windows.Forms.Padding(2); + this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(1237, 609); + this.panel1.Size = new System.Drawing.Size(1631, 750); this.panel1.TabIndex = 4; this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // @@ -88,10 +88,9 @@ this.usuariolabel.AutoSize = true; this.usuariolabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); this.usuariolabel.ForeColor = System.Drawing.Color.Navy; - this.usuariolabel.Location = new System.Drawing.Point(1321, 35); - this.usuariolabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.usuariolabel.Location = new System.Drawing.Point(1761, 43); this.usuariolabel.Name = "usuariolabel"; - this.usuariolabel.Size = new System.Drawing.Size(47, 17); + this.usuariolabel.Size = new System.Drawing.Size(56, 20); this.usuariolabel.TabIndex = 11; this.usuariolabel.Text = "Admin"; this.usuariolabel.TextAlign = System.Drawing.ContentAlignment.TopCenter; @@ -101,10 +100,9 @@ this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.label1.ForeColor = System.Drawing.Color.Navy; - this.label1.Location = new System.Drawing.Point(1292, 7); - this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label1.Location = new System.Drawing.Point(1723, 9); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(109, 25); + this.label1.Size = new System.Drawing.Size(139, 29); this.label1.TabIndex = 10; this.label1.Text = "Bienvenido"; this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; @@ -115,10 +113,9 @@ this.lblfecha.AutoSize = true; this.lblfecha.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F); this.lblfecha.ForeColor = System.Drawing.Color.Navy; - this.lblfecha.Location = new System.Drawing.Point(582, 91); - this.lblfecha.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblfecha.Location = new System.Drawing.Point(776, 112); this.lblfecha.Name = "lblfecha"; - this.lblfecha.Size = new System.Drawing.Size(126, 46); + this.lblfecha.Size = new System.Drawing.Size(159, 58); this.lblfecha.TabIndex = 9; this.lblfecha.Text = "label2"; this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter; @@ -129,10 +126,9 @@ this.lblhora.AutoSize = true; this.lblhora.Font = new System.Drawing.Font("Microsoft Sans Serif", 60F); this.lblhora.ForeColor = System.Drawing.Color.MediumBlue; - this.lblhora.Location = new System.Drawing.Point(715, -5); - this.lblhora.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblhora.Location = new System.Drawing.Point(953, -6); this.lblhora.Name = "lblhora"; - this.lblhora.Size = new System.Drawing.Size(249, 91); + this.lblhora.Size = new System.Drawing.Size(318, 113); this.lblhora.TabIndex = 8; this.lblhora.Text = "label1"; this.lblhora.Click += new System.EventHandler(this.lblhora_Click); @@ -146,27 +142,27 @@ this.flowLayoutPanel1.Controls.Add(this.button3); this.flowLayoutPanel1.Controls.Add(this.button4); this.flowLayoutPanel1.Controls.Add(this.button5); - this.flowLayoutPanel1.Location = new System.Drawing.Point(-6, -5); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2); + this.flowLayoutPanel1.Location = new System.Drawing.Point(-8, -6); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 862); + this.flowLayoutPanel1.Size = new System.Drawing.Size(324, 1061); this.flowLayoutPanel1.TabIndex = 7; // // panel2 // this.panel2.BackColor = System.Drawing.Color.Transparent; this.panel2.Controls.Add(this.pictureBox7); - this.panel2.Location = new System.Drawing.Point(2, 2); - this.panel2.Margin = new System.Windows.Forms.Padding(2); + this.panel2.Location = new System.Drawing.Point(3, 2); + this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(234, 214); + this.panel2.Size = new System.Drawing.Size(312, 263); this.panel2.TabIndex = 8; // // pictureBox7 // this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu; - this.pictureBox7.Location = new System.Drawing.Point(48, 28); - this.pictureBox7.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox7.Location = new System.Drawing.Point(64, 34); + this.pictureBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox7.Name = "pictureBox7"; this.pictureBox7.Size = new System.Drawing.Size(190, 197); this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -182,11 +178,11 @@ this.button1.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button1.Image = global::compabetov2.Properties.Resources.Menui1; this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button1.Location = new System.Drawing.Point(2, 220); - this.button1.Margin = new System.Windows.Forms.Padding(2); + this.button1.Location = new System.Drawing.Point(3, 269); + this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button1.Name = "button1"; - this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); - this.button1.Size = new System.Drawing.Size(234, 93); + this.button1.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); + this.button1.Size = new System.Drawing.Size(312, 114); this.button1.TabIndex = 8; this.button1.Text = "Menú"; this.button1.UseVisualStyleBackColor = false; @@ -201,11 +197,11 @@ this.button2.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi; this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button2.Location = new System.Drawing.Point(2, 317); - this.button2.Margin = new System.Windows.Forms.Padding(2); + this.button2.Location = new System.Drawing.Point(3, 387); + this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button2.Name = "button2"; - this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); - this.button2.Size = new System.Drawing.Size(234, 93); + this.button2.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); + this.button2.Size = new System.Drawing.Size(312, 114); this.button2.TabIndex = 9; this.button2.Text = "Estadisticas"; this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -220,11 +216,11 @@ this.button3.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button3.Image = global::compabetov2.Properties.Resources.productoi; this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button3.Location = new System.Drawing.Point(2, 414); - this.button3.Margin = new System.Windows.Forms.Padding(2); + this.button3.Location = new System.Drawing.Point(3, 505); + this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button3.Name = "button3"; - this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); - this.button3.Size = new System.Drawing.Size(234, 93); + this.button3.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); + this.button3.Size = new System.Drawing.Size(312, 114); this.button3.TabIndex = 10; this.button3.Text = "Productos"; this.button3.UseVisualStyleBackColor = false; @@ -238,11 +234,11 @@ this.button4.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button4.Image = global::compabetov2.Properties.Resources.reportesi; this.button4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button4.Location = new System.Drawing.Point(2, 511); - this.button4.Margin = new System.Windows.Forms.Padding(2); + this.button4.Location = new System.Drawing.Point(3, 623); + this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button4.Name = "button4"; - this.button4.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); - this.button4.Size = new System.Drawing.Size(234, 93); + this.button4.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); + this.button4.Size = new System.Drawing.Size(312, 114); this.button4.TabIndex = 11; this.button4.Text = "Reportes"; this.button4.UseVisualStyleBackColor = false; @@ -256,11 +252,11 @@ this.button5.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button5.Image = global::compabetov2.Properties.Resources.sesionc; this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button5.Location = new System.Drawing.Point(2, 608); - this.button5.Margin = new System.Windows.Forms.Padding(2); + this.button5.Location = new System.Drawing.Point(3, 741); + this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button5.Name = "button5"; - this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); - this.button5.Size = new System.Drawing.Size(234, 93); + this.button5.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); + this.button5.Size = new System.Drawing.Size(312, 114); this.button5.TabIndex = 12; this.button5.Text = "Salir"; this.button5.UseVisualStyleBackColor = false; @@ -269,10 +265,10 @@ // pictureBox4 // this.pictureBox4.Image = global::compabetov2.Properties.Resources.inventario; - this.pictureBox4.Location = new System.Drawing.Point(1088, 490); - this.pictureBox4.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox4.Location = new System.Drawing.Point(1451, 603); + this.pictureBox4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox4.Name = "pictureBox4"; - this.pictureBox4.Size = new System.Drawing.Size(220, 229); + this.pictureBox4.Size = new System.Drawing.Size(293, 282); this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox4.TabIndex = 6; this.pictureBox4.TabStop = false; @@ -281,10 +277,10 @@ // pictureBox5 // this.pictureBox5.Image = global::compabetov2.Properties.Resources.Cuentas; - this.pictureBox5.Location = new System.Drawing.Point(438, 490); - this.pictureBox5.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox5.Location = new System.Drawing.Point(584, 603); + this.pictureBox5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox5.Name = "pictureBox5"; - this.pictureBox5.Size = new System.Drawing.Size(220, 229); + this.pictureBox5.Size = new System.Drawing.Size(293, 282); this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox5.TabIndex = 5; this.pictureBox5.TabStop = false; @@ -293,10 +289,10 @@ // pictureBox6 // this.pictureBox6.Image = global::compabetov2.Properties.Resources.mermas; - this.pictureBox6.Location = new System.Drawing.Point(760, 490); - this.pictureBox6.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox6.Location = new System.Drawing.Point(1013, 603); + this.pictureBox6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox6.Name = "pictureBox6"; - this.pictureBox6.Size = new System.Drawing.Size(220, 229); + this.pictureBox6.Size = new System.Drawing.Size(293, 282); this.pictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox6.TabIndex = 4; this.pictureBox6.TabStop = false; @@ -305,10 +301,10 @@ // pictureBox3 // this.pictureBox3.Image = global::compabetov2.Properties.Resources.Envios; - this.pictureBox3.Location = new System.Drawing.Point(1088, 170); - this.pictureBox3.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox3.Location = new System.Drawing.Point(1451, 209); + this.pictureBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox3.Name = "pictureBox3"; - this.pictureBox3.Size = new System.Drawing.Size(220, 229); + this.pictureBox3.Size = new System.Drawing.Size(293, 282); this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox3.TabIndex = 3; this.pictureBox3.TabStop = false; @@ -317,10 +313,10 @@ // pictureBox2 // this.pictureBox2.Image = global::compabetov2.Properties.Resources.Vender; - this.pictureBox2.Location = new System.Drawing.Point(438, 170); - this.pictureBox2.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox2.Location = new System.Drawing.Point(584, 209); + this.pictureBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.Size = new System.Drawing.Size(220, 229); + this.pictureBox2.Size = new System.Drawing.Size(293, 282); this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox2.TabIndex = 2; this.pictureBox2.TabStop = false; @@ -329,10 +325,10 @@ // pictureBox1 // this.pictureBox1.Image = global::compabetov2.Properties.Resources.Personal; - this.pictureBox1.Location = new System.Drawing.Point(760, 170); - this.pictureBox1.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox1.Location = new System.Drawing.Point(1013, 209); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(220, 229); + this.pictureBox1.Size = new System.Drawing.Size(293, 282); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 1; this.pictureBox1.TabStop = false; @@ -345,11 +341,12 @@ // // MenuPrincipal // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1237, 609); + this.ClientSize = new System.Drawing.Size(1631, 750); this.Controls.Add(this.panel1); this.IsMdiContainer = true; + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "MenuPrincipal"; this.Text = "Menu "; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; diff --git a/MenuPrincipal.cs b/MenuPrincipal.cs index 4508571..6950d51 100644 --- a/MenuPrincipal.cs +++ b/MenuPrincipal.cs @@ -77,9 +77,9 @@ namespace compabetov2 private void pictureBox4_Click(object sender, EventArgs e) { inventario inventario = new inventario(loginPrincipal); - inventario.ShowDialog(); + inventario.Show(); - this.Dispose(true); + } @@ -90,10 +90,20 @@ namespace compabetov2 private void pictureBox1_Click(object sender, EventArgs e) { + + + + // Establecer el formulario de menú principal (this) como el formulario MDI padre + + + + // Mostrar el formulario de ventas + + personal personal = new personal(loginPrincipal); - personal.ShowDialog(); - this.Dispose(true); + personal.Show(); + } @@ -101,25 +111,24 @@ namespace compabetov2 { envios envios = new envios(loginPrincipal); - envios.ShowDialog(); - this.Dispose(true); + envios.Show(); + } private void pictureBox5_Click(object sender, EventArgs e) { cuentas cuentas = new cuentas(loginPrincipal); - cuentas.ShowDialog(); - this.Dispose(true); - + cuentas.Show(); +; } private void pictureBox6_Click(object sender, EventArgs e) { mermas mermas = new mermas(loginPrincipal); - mermas.ShowDialog(); + mermas.Show(); - this.Dispose(true); + } @@ -130,10 +139,19 @@ namespace compabetov2 private void pictureBox2_Click(object sender, EventArgs e) { - vender vender = new vender(loginPrincipal); - vender.ShowDialog(); - this.Dispose(true); + + vender ventasForm = new vender(loginPrincipal); + + // Establecer el formulario de menú principal (this) como el formulario MDI padre + + + + // Mostrar el formulario de ventas + ventasForm.Show(); + + + } private void label1_Click(object sender, EventArgs e) diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index dea406d..5e8ab3a 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 02f2f5e..b571675 100644 Binary files a/bin/Debug/compabetov2.pdb and b/bin/Debug/compabetov2.pdb differ diff --git a/cuentas.cs b/cuentas.cs index 3376ad3..40d1558 100644 --- a/cuentas.cs +++ b/cuentas.cs @@ -22,9 +22,28 @@ namespace compabetov2 private void button1_Click(object sender, EventArgs e) { - MenuPrincipal menuPrincipal = new MenuPrincipal(loginPrincipal); - menuPrincipal.Show(); - this.Dispose(true); + // Cerrar el formulario de ventas + this.Close(); + + // Verificar si ya hay una instancia del formulario principal + MenuPrincipal menuprincipalForm = Application.OpenForms.OfType().FirstOrDefault(); + + if (menuprincipalForm == null) + { + // Si no hay una instancia, crear una nueva + menuprincipalForm = new MenuPrincipal(loginPrincipal); + + // Establecer el formulario principal como el formulario MDI padre + menuprincipalForm.MdiParent = this.MdiParent; + + // Mostrar el formulario principal + menuprincipalForm.Show(); + } + else + { + // Si ya hay una instancia, simplemente llevarlo al frente + menuprincipalForm.BringToFront(); + } } } } diff --git a/envios.cs b/envios.cs index 47611e2..70cc171 100644 --- a/envios.cs +++ b/envios.cs @@ -22,9 +22,28 @@ namespace compabetov2 private void button1_Click(object sender, EventArgs e) { - MenuPrincipal menuPrincipal = new MenuPrincipal(loginPrincipal); - menuPrincipal.Show(); - this.Dispose(true); + // Cerrar el formulario de ventas + this.Close(); + + // Verificar si ya hay una instancia del formulario principal + MenuPrincipal menuprincipalForm = Application.OpenForms.OfType().FirstOrDefault(); + + if (menuprincipalForm == null) + { + // Si no hay una instancia, crear una nueva + menuprincipalForm = new MenuPrincipal(loginPrincipal); + + // Establecer el formulario principal como el formulario MDI padre + menuprincipalForm.MdiParent = this.MdiParent; + + // Mostrar el formulario principal + menuprincipalForm.Show(); + } + else + { + // Si ya hay una instancia, simplemente llevarlo al frente + menuprincipalForm.BringToFront(); + } } private void horafecha_Tick(object sender, EventArgs e) diff --git a/inventario.cs b/inventario.cs index 9c39f3b..cbc0a7a 100644 --- a/inventario.cs +++ b/inventario.cs @@ -154,11 +154,31 @@ namespace compabetov2 private void button1_Click(object sender, EventArgs e) { - MenuPrincipal menuPrincipal = new MenuPrincipal(loginPrincipal); - menuPrincipal.ShowDialog(); - + // Cerrar el formulario de ventas this.Close(); + + // Verificar si ya hay una instancia del formulario principal + MenuPrincipal menuprincipalForm = Application.OpenForms.OfType().FirstOrDefault(); + + if (menuprincipalForm == null) + { + // Si no hay una instancia, crear una nueva + menuprincipalForm = new MenuPrincipal(loginPrincipal); + + // Establecer el formulario principal como el formulario MDI padre + menuprincipalForm.MdiParent = this.MdiParent; + + // Mostrar el formulario principal + menuprincipalForm.Show(); + } + else + { + // Si ya hay una instancia, simplemente llevarlo al frente + menuprincipalForm.BringToFront(); + } + + } private void button6_Click(object sender, EventArgs e) diff --git a/mermas.cs b/mermas.cs index 1c210c5..ac0666c 100644 --- a/mermas.cs +++ b/mermas.cs @@ -146,9 +146,29 @@ namespace compabetov2 private void button1_Click(object sender, EventArgs e) { - MenuPrincipal menuPrincipal = new MenuPrincipal(loginPrincipal); - menuPrincipal.ShowDialog(); - this.Dispose(true); + // Cerrar el formulario de ventas + this.Close(); + + // Verificar si ya hay una instancia del formulario principal + MenuPrincipal menuprincipalForm = Application.OpenForms.OfType().FirstOrDefault(); + + if (menuprincipalForm == null) + { + // Si no hay una instancia, crear una nueva + menuprincipalForm = new MenuPrincipal(loginPrincipal); + + // Establecer el formulario principal como el formulario MDI padre + menuprincipalForm.MdiParent = this.MdiParent; + + // Mostrar el formulario principal + menuprincipalForm.Show(); + } + else + { + // Si ya hay una instancia, simplemente llevarlo al frente + menuprincipalForm.BringToFront(); + } + } private void mermaPanel_Paint(object sender, PaintEventArgs e) diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 7a5c292..a946389 100644 Binary files a/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/obj/Debug/compabetov2.exe b/obj/Debug/compabetov2.exe index dea406d..5e8ab3a 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 02f2f5e..b571675 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ diff --git a/personal.cs b/personal.cs index 8cb068c..4ed4ee3 100644 --- a/personal.cs +++ b/personal.cs @@ -226,9 +226,31 @@ namespace compabetov2 private void button1_Click(object sender, EventArgs e) { - MenuPrincipal menuPrincipal = new MenuPrincipal(loginPrincipal); - menuPrincipal.ShowDialog(); - this.Dispose(true); + + + + // Cerrar el formulario de ventas + this.Close(); + + // Verificar si ya hay una instancia del formulario principal + MenuPrincipal menuprincipalForm = Application.OpenForms.OfType().FirstOrDefault(); + + if (menuprincipalForm == null) + { + // Si no hay una instancia, crear una nueva + menuprincipalForm = new MenuPrincipal(loginPrincipal); + + // Establecer el formulario principal como el formulario MDI padre + menuprincipalForm.MdiParent = this.MdiParent; + + // Mostrar el formulario principal + menuprincipalForm.Show(); + } + else + { + // Si ya hay una instancia, simplemente llevarlo al frente + menuprincipalForm.BringToFront(); + } } } } diff --git a/vender.cs b/vender.cs index 02cf259..8961cd0 100644 --- a/vender.cs +++ b/vender.cs @@ -362,9 +362,28 @@ namespace compabetov2 private void button1_Click(object sender, EventArgs e) { - MenuPrincipal menuPrincipal = new MenuPrincipal(loginPrincipal); - menuPrincipal.ShowDialog(); - this.Dispose(true); + // Cerrar el formulario de ventas + this.Close(); + + // Verificar si ya hay una instancia del formulario principal + MenuPrincipal menuprincipalForm = Application.OpenForms.OfType().FirstOrDefault(); + + if (menuprincipalForm == null) + { + // Si no hay una instancia, crear una nueva + menuprincipalForm = new MenuPrincipal(loginPrincipal); + + // Establecer el formulario principal como el formulario MDI padre + menuprincipalForm.MdiParent = this.MdiParent; + + // Mostrar el formulario principal + menuprincipalForm.Show(); + } + else + { + // Si ya hay una instancia, simplemente llevarlo al frente + menuprincipalForm.BringToFront(); + } } private void flowLayoutPanel2_Paint(object sender, PaintEventArgs e)