设置全屏:
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
this.TopMost = true; //这个一定要设置,不然一般会出现Bug
取消全屏,正常化:
this.FormBorderStyle = FormBorderStyle.Sizable;
this.WindowState = FormWindowState.Normal;
最小化:
this.FormBorderStyle = FormBorderStyle.Sizable;
this.WindowState = FormWindowState.Minimized;
获取屏幕尺寸:
int ScreenHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; //显示器高度
int ScreenWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; //显示器宽度
设置窗体居中最顶端显示
this.SetBounds((System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width - this.Width) / 2, 0, this.Width, this.Height);
如再要使得某个控件全屏,如GlobeContril、MapControl,只需要将他们的Top、Left、Width、Height等属性
设置为屏幕大小即可。