示例#1
0
        private void ToolCliente_Click(object sender, EventArgs e)
        {
            //frnCliente frm = new frnCliente();
            //frm.MdiParent = this;
            //OpenSubForm(frm);

            Form childForm = null;
            foreach (Form f in this.MdiChildren)
            {
                if (f is frmCliente)
                {
                    childForm = (frmCliente)f;
                    break;
                }
                else
                {
                    f.WindowState = FormWindowState.Minimized;
                    f.Show();
                }

            }

            if (childForm != null)
            {
                childForm.Focus();
                childForm.BringToFront();
                childForm.WindowState = FormWindowState.Normal;
            }
            else
            {
                childForm = new frmCliente();
                childForm.MdiParent = this;
                OpenSubForm(childForm);
            }
        }
 private void btnCliente_Click(object sender, EventArgs e)
 {
     frmCliente frm = new frmCliente();
     frm.ShowDialog();
 }