1

I have a windows form. I'm setting it's size using the following code. My desired behaviour is to have it take the full width and half the height of the primary display.

this.Location = new Point(0, 0);
this.WindowState = FormWindowState.Normal;
this.Size = new System.Drawing.Size(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height / 2);

The problem is there is a space on the right form (it's not taking up the full screen). Does anyone have any suggestions as to why?

Thanks

probably at the beach
  • 14,489
  • 16
  • 75
  • 116

2 Answers2

0

Try use

Screen.PrimaryScreen.WorkingArea
JleruOHeP
  • 10,106
  • 3
  • 45
  • 71
0

Two ways to make it fullscreen:

// maximize the form
this.WindowState = FormWindowState.Maximized;

or

// hide the border
this.FormBorderStyle = FormBorderStyle.None;

You can try them together but have to notice the order, hide the border first, then set the window state to maximized.

Corey
  • 1,217
  • 3
  • 22
  • 39