How can I change window form size at runtime?
I saw examples, but every one requires Form.Size property. This property can be set like here: http://msdn.microsoft.com/en-us/library/25w4thew.aspx#Y456,
but I’ve created my application form in a visual tool and the form is created like this:
static void Main()
{
Application.Run(new Form());
}
How do I set that Size property now and then change it by the Form.Height and Form.Width methods?
If you want to manipulate the form programmatically the simplest solution is to keep a reference to it:
You can then use that to change the size (or what ever else you want to do) at run time. Though as Arrow points out you can’t set the
WidthandHeightdirectly but have to set theSizeproperty.