full screen mode, but don't cover the taskbar

前端 未结 10 1337
旧巷少年郎
旧巷少年郎 2020-12-05 19:38

I have a WinForms application, which is set to full screen mode when I login.

My problem is it\'s covering the Windows taskbar also. I don\'t want my application to

10条回答
  •  我在风中等你
    2020-12-05 20:33

    Arcanox's answer is great for a single monitor, but if you try it on any screen other than the leftmost, it will just make the form disappear. I used the following code instead.

    var workingArea = Screen.FromHandle(Handle).WorkingArea;
    MaximizedBounds =  new Rectangle(0, 0, workingArea.Width, workingArea.Height);
    WindowState = FormWindowState.Maximized;
    

    The only difference is I'm overriding the top & left values to be 0, 0 since they will be different on other screens.

提交回复
热议问题