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);

 

posted @ 2016-01-19 14:08  天马3798  阅读(1617)  评论(0编辑  收藏  举报