Search code examples
c#screen-orientation

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;

Solution

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

    You will get a ScreenOrientation-enumeration back.

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

    Prints 'Angle0' on my system with default orientation