How do I make a WinForms app go Full Screen

前端 未结 9 1374
你的背包
你的背包 2020-11-22 11:20

I have a WinForms app that I am trying to make full screen (somewhat like what VS does in full screen mode).

Currently I am setting FormBorderStyle to <

9条回答
  •  花落未央
    2020-11-22 12:09

    You can use the following code to fit your system screen and task bar is visible.

        private void Form1_Load(object sender, EventArgs e)
        {   
            // hide max,min and close button at top right of Window
            this.FormBorderStyle = FormBorderStyle.None;
            // fill the screen
            this.Bounds = Screen.PrimaryScreen.Bounds;
        }
    

    No need to use:

        this.TopMost = true;
    

    That line interferes with alt+tab to switch to other application. ("TopMost" means the window stays on top of other windows, unless they are also marked "TopMost".)

提交回复
热议问题