private void sale_pnl_Click_1(object sender, EventArgs e) { bool IsOpen = false; int tabcount = 0; foreach (Form f in Application.OpenForms) { if (f.Text == "Sale") { tabForms.SelectedTab = tabForms.TabPages[tabcount - 2]; IsOpen = true; f.Focus(); break; } tabcount++; } if (IsOpen == false) { frmSale frm = new frmSale(); frm.FormBorderStyle = FormBorderStyle.None; frm.StartPosition = FormStartPosition.Manual; frm.Location = new Point((this.Width - frm.Width) / 2, this.Location.Y + (this.Height - frm.Height) / 2); this.pnlMain.Visible = false; frm.MdiParent = this; frm.Show(); } }
private void BtnSales_Click(object sender, EventArgs e) { frmSale frmSales = new frmSale(); frmSales.TopLevel = false; panelMain.Controls.Add(frmSales); frmSales.BringToFront(); frmSales.Show(); }