How can you make the form maximize to any computer screen in a Windows Forms application?

George Tyler picture George Tyler · Jun 2, 2010 · Viewed 63.7k times · Source

So I am making a game on Visual Studio C# and I want the form to be automatically maximized to any user's computer screen when compiled? How can I do that?

Answer

Ram picture Ram · Jun 2, 2010

You can do it using one of the following --

  1. Set the form WindowState = FormWindowState.Maximized;
  2. Get the screen resolution using following code and set the size of your forms accordingly

    int height = Screen.PrimaryScreen.Bounds.Height; 
    int width = Screen.PrimaryScreen.Bounds.Width;