private void button3_Click(object sender, EventArgs e) { /* HangHoa a = new HangHoa(); * a.Dock = DockStyle.Fill; * this.panelControl.Controls.Add(a); * foreach (Control ctrl in panelControl.Controls) * { * if (ctrl != a) * ctrl.Dispose(); * }*/ HangHoa hh = new HangHoa() { Dock = DockStyle.Fill, TopLevel = false, TopMost = true }; hh.FormBorderStyle = FormBorderStyle.None; this.panelControl.Controls.Add(hh); foreach (Control ctrl in panelControl.Controls) { if (ctrl != hh) { ctrl.Dispose(); } } hh.Show(); }
private void barbtnhanghoa_ItemClick(object sender, ItemClickEventArgs e) { HangHoa HangHoa = new HangHoa(); if (ExistsForm(HangHoa)) { return; } HangHoa.MdiParent = this; HangHoa.Show(); }