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

4

2 回答 2

0

尝试使用

Screen.PrimaryScreen.WorkingArea
于 2012-08-14T13:14:01.403 回答
0

使其全屏的两种方法:

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

或者

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

你可以一起尝试,但要注意顺序,先隐藏边框,然后将窗口状态设置为最大化。

于 2021-09-23T02:41:56.763 回答