C# winform 画面最大化size设定

1.画面最大化时,画面的边框会不显示。然后在计算子画面的位置用主画面的size计算会有一定偏差。

我们可以在画面的构造函数中设定:this.MaximizedBounds =new  Rectangle(1, 1, SystemInformation.WorkingArea.Width, SystemInformation.WorkingArea.Height);

2.画面中使用一些插件,可能右边被占用,画面在Normal时可以和右边共存,可以最大化

可以在构造函数中写

 if (Common.Common_Func.pRegKey == 14 && scale >= 1.5)
            {
                if (frm.WindowState == FormWindowState.Maximized)
                {
                    frm.Size = new System.Drawing.Size(SystemInformation.WorkingArea.Width * 3 / 4, SystemInformation.WorkingArea.Height);
                }
            }

 

然后在画面Load中写

 if (Common.Common_Func.pRegKey == 14 && Common_Func.scale >= 1.5)
            {
                this.WindowState = System.Windows.Forms.FormWindowState.Normal;
            }

画面启动就不是最大化了。

posted @ 2016-07-01 16:10  Net-Spider  阅读(1378)  评论(0)    收藏  举报