I am running two forms simultaneously and I am trying to resize Form1
by calling a Form1
method with an event in Form2
. With the following code the proper size values are displayed in the console, but the size of Form1
does not change. I have tried a number of approaches but I don't see why this does not work.
In Form1:
public void ResizeForm()
{
Console.WriteLine(this.Size.ToString());
this.Size = new System.Drawing.Size(600, 300);
}
In Form2:
private void ResizeCheckbox_CheckedChanged(object sender, EventArgs e)
{
Form1 form = new Form1();
form.ResizeForm();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…