以下核心代码
public static Form frm; private void button1_Click(object sender, EventArgs e) { if (frm == null || string.IsNullOrEmpty(frm.Text)) { frm = new Form2(); frm.Show(); } else { frm.WindowState = FormWindowState.Normal; frm.BringToFront(); } }
以下核心代码
public static Form frm; private void button1_Click(object sender, EventArgs e) { if (frm == null || string.IsNullOrEmpty(frm.Text)) { frm = new Form2(); frm.Show(); } else { frm.WindowState = FormWindowState.Normal; frm.BringToFront(); } }