/// <summary>
/// 在同一应用程序中同一窗体只打开一个
/// </summary>
/// <param name="frmOpen">要打开的窗体实例</param>
/// <returns></returns>
public static void OpenSeamForm(Form frmOpen)
{
foreach (Form frm in Application.OpenForms)
{
if (frm.Text == frmOpen.Text)
{
frm.Visible = true;
frm.WindowState = FormWindowState.Normal;
frm.Activate();
return;
}
}
frmOpen.Show();
}
/// 在同一应用程序中同一窗体只打开一个
/// </summary>
/// <param name="frmOpen">要打开的窗体实例</param>
/// <returns></returns>
public static void OpenSeamForm(Form frmOpen)
{
foreach (Form frm in Application.OpenForms)
{
if (frm.Text == frmOpen.Text)
{
frm.Visible = true;
frm.WindowState = FormWindowState.Normal;
frm.Activate();
return;
}
}
frmOpen.Show();
}