获取屏幕分辨率(C#)

时间:2021-12-01 11:57:10

C#获取屏幕分辨率的方法

 static void Main(string[] args)
{
// 控制台程序,需要添加程序集:
// using System.Drawing;
// using System.Windows.Forms; Console.Title = "Dan.Jacky QQ:773091523";
Console.ForegroundColor = ConsoleColor.Green; int SW = Screen.PrimaryScreen.Bounds.Width;
int SH = Screen.PrimaryScreen.Bounds.Height;
Console.WriteLine(string.Format("当前屏幕的分辨率为:{0}×{1}", SW, SH)); Console.ReadKey(true);
}