获取桌面宽度和高度
获取桌面的宽度:Screen.PrimaryScreen.WorkingArea.Width;
获取桌面的高度:Screen.PrimaryScreen.WorkingArea.Height;
获取桌面的高度:Screen.AllScreens[0].WorkingArea.Height;
Screen.PrimaryScreen.WorkingArea属性用于获取显示器的工作区。工作区是显示器的桌面区域,不包括任务栏、停靠窗口和停靠工具栏。
得到屏幕的范围:Screen.GetWorkingArea(new Point(0,0));
Screen screen = Screen.PrimaryScreen;
int screenWidth = screen.Bounds.Width;
int screenHeight = screen.Bounds.Height;