O零O

我和谁都不争,和谁争我都不屑,我爱生活,其次是技术。

导航

C#获取屏幕分辨率(WinForm)

Posted on 2010-08-11 09:53  O零O  阅读(3649)  评论(0)    收藏  举报

using System.Windows.Forms;
            获取屏幕分辨率
            int SH = Screen.PrimaryScreen.Bounds.Height;
            int SW = Screen.PrimaryScreen.Bounds.Width;  
            获取窗口居中Top和Left
            int thisH=100;
            int thisW=200;
            int SH = (Screen.PrimaryScreen.Bounds.Height - 30 - thisH) / 2;
            int SW = (Screen.PrimaryScreen.Bounds.Width - 10 - thisW) / 2;