C#根据屏幕大小设置窗体

来源:互联网 发布:php trim 不起作用 编辑:程序博客网 时间:2024/05/01 22:51

//根据屏幕大小设置窗体初始大小

//Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;

Rectangle rect = SystemInformation.WorkingArea;

this.Height = rect.Height;

this.Width = rect.Width;

//根据屏幕大小设置窗体最大化大小

this.MaximizedBounds = new Rectangle(rect.X, rect.Y, rect.Width – 2, rect.Height – 2);

原创粉丝点击