C#实现主窗体在屏幕中间显示

第一行:int w = System.Windows.Forms.SystemInformation.WorkingArea.Width;
第二行:int h = System.Windows.Forms.SystemInformation.WorkingArea.Height;
第三行:this.Location = new Point(w/2-250,h/2-180);

第一行:代码获取计算机屏幕宽度

第二行:代码获取计算机屏幕高度

第三行:设置主窗体显示在计算机屏幕的位置

此种方法是最靠谱的方法,具体位置大家自己调整

 

posted @ 2016-08-06 11:54  kennyhip  阅读(4793)  评论(0)    收藏  举报