WinForm 全屏
不带任务栏
public partial class Form1 : Form { public Form1() { //可交换顺序(方式1) this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; InitializeComponent(); //可交换顺序(方式2) this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; } private void Form1_Load(object sender, EventArgs e) { //不可交换顺序(方式3) this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; } }
带任务栏
public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //不可交换顺序 this.WindowState = FormWindowState.Maximized; this.FormBorderStyle = FormBorderStyle.None; } }