Exemplo n.º 1
0
        private void ToolColor_Click(object sender, EventArgs e)
        {
            //frmColor frm = new frmColor();
            //frm.MdiParent = this;
            //OpenSubForm(frm);

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

            }

            if (childForm != null)
            {
                childForm.Focus();
                childForm.BringToFront();
                childForm.WindowState = FormWindowState.Normal;
            }
            else
            {
                childForm = new frmColor();
                childForm.MdiParent = this;
                OpenSubForm(childForm);
            }
        }