private void btnHome_Click(object sender, EventArgs e) { int nI = 0; foreach (Form form in Application.OpenForms) { if (form.Name == "frmMonitorView") { form.Activate(); form.BringToFront(); nI++; } } if (nI == 0) { frmMonitorView MonitorView = new frmMonitorView(); MonitorView.MdiParent = this; this.splitContainer2.Panel2.Controls.Add(MonitorView); MonitorView.Dock = DockStyle.Fill; MonitorView.Show(); } }
private void frmMain_Load(object sender, EventArgs e) { toolStripStatusLabel2.Text = userName.ToString(); int nI = 0; foreach (Form form in Application.OpenForms) { if (form.Name == "frmMonitorView") { form.Activate(); form.BringToFront(); nI++; } } if (nI == 0) { frmMonitorView MonitorView = new frmMonitorView(); MonitorView.MdiParent = this; this.splitContainer2.Panel2.Controls.Add(MonitorView); MonitorView.Dock = DockStyle.Fill; MonitorView.Show(); } }