form1 代码:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.form1 = this;
frm.Show();
}
}
form2 代码:
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public
Form1 form1
{
get;
set;
}
private void button1_Click(object sender, EventArgs e)
{
form1.button1.Visible = false;
this.Close();
}
}
form1 有button1 button2
单击button2 显示form2;from1的button1的Modifier属性设置成internal或者public
form2 有button1 单击button1 form2关闭,form1中的button1“消失”;
不知道你要的是不是这个效果。。。。