相信不少的计算机编程人员优势一定想自己编写几个有趣实用的小程序,那么你有没有想过怎么样用C#获得屏幕分辨率的方法呢?今天就给大家介绍一下我自己的实现方法。
其核心程序如下:
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;
