0

I am developing Windows 8.1 Application, currently I am, struggling with getting the actual screen size in inches or any other measurement unit.

Is it possible to get that information?

Pavel Durov
  • 1,287
  • 2
  • 13
  • 28

1 Answers1

0
var bounds = Window.Current.Bounds;
    double w = bounds.Width;
    double h = bounds.Height;
    switch (DisplayProperties.ResolutionScale)
    {
       case ResolutionScale.Scale140Percent:
            w = Math.Ceiling(w * 1.4);
            h = Math.Ceiling(h * 1.4);
            break;
        case ResolutionScale.Scale180Percent:
            w = Math.Ceiling(w * 1.8);
            h = Math.Ceiling(h * 1.8);
            break;
    }

    Size resolution = new Size(w, h);

Answer taken from here: link and here: link

Community
  • 1
  • 1
Ketobomb
  • 2,108
  • 1
  • 17
  • 27
  • This code gives me a resolution, what I want is the size of the screen in inches. I ran this code in blank app and also get wrong resolution - I think it's cause it's based on Window.Current.Bounds - which is the dimensions of my current windows application, and not my screen dimensions. – Pavel Durov Oct 30 '15 at 10:41
  • You can get the DPI like this: Windows.Graphics.Display.DisplayProperties.LogicalDpi and then calculate the size: pixles / DPI = Inches – Ketobomb Oct 30 '15 at 10:52