public MainFormSample() { // // Required for Windows Form Designer support // InitializeComponent(); contentsMain = new Contents(); contentsMain.MdiParent = this; contentsMain.CNButtonClicked += new EventHandler(CN_contents_ButtonClicked); contentsMain.OPButtonClicked += new EventHandler(OP_contents_ButtonClicked); contentsMain.Show(); //mainProgramDisable(); //PP = new ProductProtection.ProductProtection(); //PP.continueButtonClicked += new EventHandler(continueButtonClicked_ButtonClicked); //PP.Show(); }
void Form2_FormClosed(object sender, FormClosedEventArgs e) { Form[] charr = this.MdiChildren; int count = 0; //bool temp = false; foreach (Form chform in charr) { count++; } //MessageBox.Show(count+""); if (count <= 1) { contentsMain = null; if ((contentsMain = (Contents)IsFormAlreadyOpen(typeof(Contents))) == null) { contentsMain = new Contents(); contentsMain.MdiParent = this; contentsMain.CNButtonClicked += new EventHandler(CN_contents_ButtonClicked); contentsMain.OPButtonClicked += new EventHandler(OP_contents_ButtonClicked); contentsMain.Show(); contentsMain.WindowState = FormWindowState.Normal; } else { contentsMain.Select(); // may be UForm.Select(); } } }