从 Form1 我一直在打开 Form2。如果我然后单击 Form1 中的按钮或任何内容,我希望激活 Form2。就像是
Form2.Activate();
但这只会给我错误。
这是我现在的代码:
private void button1_Click(object sender, EventArgs e) // first I click here
{
Form2 f2 = new Form2();
f2.Show();
}
private void button2_Click(object sender, EventArgs e) // then here, to activate it
{
Form2 f2 = new Form2();
f2.Activate();
}