【发布时间】:2019-05-03 10:15:38
【问题描述】:
我已经编写了一个可以旋转我的第三个显示器的代码。
现在我想先检查一下,当前显示的方向是什么。
我写了以下代码:
int scrRectHeight = Screen.PrimaryScreen.Bounds.Height;
int scrRectWidth = Screen.PrimaryScreen.Bounds.Width;
if (scrRectHeight > scrRectWidth)
{
Display.Rotate(3, Display.Orientations.DEGREES_CW_90;
}
else
{
Display.Rotate(3, Display.Orientations.DEGREES_CW_180;
}
这很好用,但它只适用于主显示器。我找不到将其更改为第二个显示的定义。我该如何更改它,或者有其他方法吗?谢谢!
【问题讨论】:
-
如果您想查看第二个屏幕 Screen.AllScreens[1] 的属性,请考虑不使用 PrimaryScreen。
-
@HansPassant 我不明白如何使用 AllScreens。就是这么简单!谢谢
-
@HansPassant 你能把它添加为答案以便我标记它吗?
-
我很难识别这段代码中的大脑错误。只需分享您在自己的帖子中发现的内容并将其标记为答案即可。
标签: c# multiple-monitors