Saturday, 2 January 2010

Window State

When you run an application you may have a start up form and other forms that are called from this form. When you open any form you can have it set to open at maximum size, minimum size or normal, normal is the button you see in Windows at the top right of the screen, between the 'x' and underscore '_' .

If you want to set your form to be a certain size when you run the application, you set the property WindowState in the properties to the size you want : Minimised, Normal, or Maximised.

You can also set this at runtime wherever you choose. The code would look like this:

Me.WindowState = FormWindowState.Maximized

or if you were calling this routine from somewhere other than the form itself

form.WindowState = FormWindowState.Maximized

The form being the name of the form you are trying to change the size of.

No comments:

Post a Comment