public void ShowMdi(string frmName)
{
foreach (Form mdiFrm in this.MdiChildren)
{
if (mdiFrm.GetType().Name == frmName)
{
mdiFrm.Activate();
mdiFrm.BringToFront();
return;
}
}
Form frm = null;
switch (frmName)
{
case "InputCodeFrm":
frm = new InputCodeFrm();
break;
case "WeightFrm":
frm = new WeightFrm();
break;
}
if (frm != null)
{
frm.MdiParent = this;
frm.WindowState = FormWindowState.Maximized;
frm.Show();
}
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
ShowMdi("InputCodeFrm");
}
private void toolStripButton3_Click(object sender, EventArgs e)
{
ShowMdi("WeightFrm");
{
foreach (Form mdiFrm in this.MdiChildren)
{
if (mdiFrm.GetType().Name == frmName)
{
mdiFrm.Activate();
mdiFrm.BringToFront();
return;
}
}
Form frm = null;
switch (frmName)
{
case "InputCodeFrm":
frm = new InputCodeFrm();
break;
case "WeightFrm":
frm = new WeightFrm();
break;
}
if (frm != null)
{
frm.MdiParent = this;
frm.WindowState = FormWindowState.Maximized;
frm.Show();
}
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
ShowMdi("InputCodeFrm");
}
private void toolStripButton3_Click(object sender, EventArgs e)
{
ShowMdi("WeightFrm");
}