Я написал код, который вращает мой третий дисплей.
Теперь я хочу сначала проверить, в какой ориентации на данный момент отображается.
Я написал следующий код:
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;
}
Это прекрасно работает, но работает только для основного дисплея. Я не могу найти определение, чтобы изменить его на второй дисплей. Как я могу изменить его или есть другой метод? Спасибо!
Не существует свойства SecondaryScreen.
Попробуйте это вместо этого:
int secondRectHeight = Screen.AllScreens[1].Bounds.Height;
int secondRectWidth = Screen.AllScreens[1].Bounds.Width;
if (secondRectHeight > secondRectWidth)
{
Display.Rotate(3, Display.Orientations.DEGREES_CW_90;
}
else
{
Display.Rotate(3, Display.Orientations.DEGREES_CW_180;
}