上form1
,我有registerButton
一个新的,上面registerForm
有一个acceptButton
。两者都是动态创建的:
private void registerButton_Click(object sender, EventArgs e)
{
registerButton.Enabled = false;
Form registrationForm = new Form();
registrationForm.Text = "Register new account";
registrationForm.Visible = true;
Button createButton = new Button();
createButton.Text = "Accept";
registrationForm.Controls.Add(createButton);
createButton.Click+= new EventHandler(createButton_Click);
}
registerForm
点击后如何关闭acceptButton
而不关闭form1
?