110,536
社区成员
发帖
与我相关
我的任务
分享
public partial class Form1 : Form
{
Form2 f2;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
f2.SetButton();
}
private void Form1_Load(object sender, EventArgs e)
{
f2 = new Form2(this);
f2.Show();
}
public void SetButton()
{
button1.Text = "fuck";
}
}
public partial class Form2 : Form
{
Form1 f1;
public Form2(Form1 f)
{
InitializeComponent();
f1 = f;
}
private void button1_Click(object sender, EventArgs e)
{
f1.SetButton();
}
public void SetButton()
{
button1.Text = "fuck you";
}
}
public partial class Form1 : Form
{
Form2 f2;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f22 =(Form2) this.MdiChildren[0];
f22.SetButton();
}
private void Form1_Load(object sender, EventArgs e)
{
f2 = new Form2();
f2.MdiParent = this;
//f2.WindowState = FormWindowState.Maximized;
f2.Show();
}
public void SetButton()
{
button1.Text = "fuck";
}
}
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 f1 = (Form1)this.ParentForm;
f1.SetButton();
}
public void SetButton()
{
button1.Text = "fuck you";
}
}