C# 获取屏幕方向

C# 获取屏幕方向,c#,screen-orientation,C#,Screen Orientation,如何使用C#查找当前屏幕方向 我已经尝试了以下代码,但没有取得多大成功 DisplayOrientations currentOrientation = Windows.Graphics.Display.DisplayProperties.CurrentOrientation; 您可以取而代之的是-object,然后取而代之的是它的屏幕方向 你会得到一个-枚举回来 var orientation = SystemInformation.ScreenOrientation; Console.W

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

我已经尝试了以下代码,但没有取得多大成功

DisplayOrientations currentOrientation = 
Windows.Graphics.Display.DisplayProperties.CurrentOrientation;
您可以取而代之的是-object,然后取而代之的是它的屏幕方向

你会得到一个-枚举回来

var orientation = SystemInformation.ScreenOrientation;
Console.WriteLine(orientation);
在我的系统上以默认方向打印“Angle0”

您可以改为使用-对象并获取其屏幕方向

你会得到一个-枚举回来

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

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

执行上述代码后,检查“currentOrientation”变量中的值是多少?参考:可能重复谢谢大家,我从下面的帖子中得到了答案,-------var orientation=SystemInformation.ScreenOrientation;控制台写入线(方向);执行上述代码后,检查“currentOrientation”变量中的值是多少?参考:可能重复谢谢大家,我从下面的帖子中得到了答案,-------var orientation=SystemInformation.ScreenOrientation;控制台写入线(方向);非常好用,非常感谢您的快速响应。非常好用,非常感谢您的快速响应。