开发者

Maximize Form from differient form C#

Does anyone know how to maximize a form from another form, in c#?

I tried the code below but it won't work:

Form1 form1 = new Form1();
form1.WindowStat开发者_开发知识库e = FormWindowState.Maximized;

Any ideas?


Well two possible problems, either you don't get any form at all, then the solution is to Show the form.

Form1 form1 = new Form1();
form1.WindowState = FormWindowState.Maximized;
form1.Show();

But I guess that you already have a form1 loaded somewhere, then you can not use

Form1 form1 = new Form1();

because then you creates a new form that you don't display, remove this line and find a way to pass a reference to form1 from where it was originally created to the method where the above code is located.


  1. Go To Load Form Or Button As View Code and use This Code :

C#

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

I hope it will be useful for you ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜