C#获取显示器宽度高度,桌面宽度高度等

1.C#获取显示器宽度高度,桌面宽度高度等

//获取当前显示器的宽度和高度
int width = Screen.PrimaryScreen.Bounds.Width;
int height = Screen.PrimaryScreen.Bounds.Height;
Console.WriteLine(width + "*" + height);
//获取当前桌面工作区域的宽度高度(去除工具栏等)
int workWidth = Screen.PrimaryScreen.WorkingArea.Width;
int workHeight = Screen.PrimaryScreen.WorkingArea.Height;
Console.WriteLine(workWidth + "*" + workHeight);

 

你可能感兴趣的:(C#获取显示器宽度高度,桌面宽度高度等)