Chikku Jacob Chikku Jacob - 3 years ago 237
C# Question

C# Get Screen Orientation

How to find the current screen orientation using C#?

I have tried the following code without much success.

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

Answer Source

You can take the SystemInformation-object instead and take its ScreenOrientation.

You will get a ScreenOrientation-enumartion back.

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

Prints 'Angle0' on my system with default orientation

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download