这个问题在这里已有答案:
我的屏幕尺寸有问题。我希望从Windows窗体程序中获取屏幕大小,但是当我这样做时:
Rectangle bounds = Screen.AllScreens[0].Bounds;
bounds.Width = 1536而不是1920(我的分辨率屏幕)。
请问你能帮帮我吗 ?
也许试试这个:
Screen.PrimaryScreen.Bounds.Width;
Screen.PrimaryScreen.Bounds.Height;
Screen.PrimaryScreen.Bounds.Size;
也许你选错了显示器?因为Screen是用于获取屏幕res的主要lib。
Rectangle resolution = Screen.PrimaryScreen.Bounds
这有帮助吗?您的代码为我返回正确的屏幕尺寸
int count = Screen.AllScreens.Count();
for (int itr = 0; itr < count; itr++) {
Console.WriteLine("The width of screen {0} is {1}", itr, Screen.AllScreens[itr].Bounds.Width);
}
上面的代码将遍历您的所有监视器