/* * 用户: NAMEJR * 日期: 2019/8/22 * 时间: 22:42 */ using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace SP { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } void MainFormLoad(object sender, EventArgs e) { Rectangle ScreenSize = System.Windows.Forms.Screen.GetWorkingArea(this); // 获取屏幕宽度(不包括状态栏) Rectangle ScreenSize2 = System.Windows.Forms.Screen.GetBounds(this); // 获取屏幕宽度(包括状态栏) int width = ScreenSize2.Width; // 获取屏幕宽度 int height = ScreenSize2.Height; // 获取屏幕高度 this.Location= new Point(0,0); // 定位 this.Size = new Size(ScreenSize.Width,ScreenSize.Height); // 设置当前窗体的大小 } } }
//