C# 获取屏幕方向

C# Get Screen Orientation

如何使用 C# 查找当前屏幕方向?

我尝试了以下代码,但没有成功。

DisplayOrientations currentOrientation = 
Windows.Graphics.Display.DisplayProperties.CurrentOrientation;

您可以采用 SystemInformation-object 并采用其 ScreenOrientation。

您将得到一个 ScreenOrientation-enumartion。

var orientation = SystemInformation.ScreenOrientation;
Console.WriteLine(orientation);

在我的系统上以默认方向打印 'Angle0'