locked
Windows 8.1 Logical DPI RRS feed

  • Question

  • Hello

    I was trying to fetch the logical dpi of my app with this:

    Windows.Graphics.Display.DisplayProperties.LogicalDpi

    But after I inserted it, it was underlined green saying 'Windows.Graphics.Display.DisplayProperties.LogicalDpi' is obsolete: 'DisplayProperties may be altered or unavailable for releases after Windows 8.1. Instead, use DisplayInformation.'

    I have used DisplayInformation but I do not know how to get the dpi with it. I checked the definition and the whole class is sealed compared to DisplayProperties and the LogicalDpi isn't static either.

    Help :(

    Thank you


    If you don't gain anything from arguing with someone, do yourself a favor and stop wasting your time for free.

    Saturday, December 14, 2013 3:33 PM

Answers

  • I figured it out but it displays 96 dpi on my PC (1920 x 1080) which is correct but also on my tablet which has the resolution of 1280 x 800 and the dpi should be 125

    Windows.Graphics.Display.DisplayInformation displayInformation = Windows.Graphics.Display.DisplayInformation.GetForCurrentView();
    Int16 a = Convert.ToInt16(displayInformation.LogicalDpi);


    If you don't gain anything from arguing with someone, do yourself a favor and stop wasting your time for free.


    Saturday, December 14, 2013 4:03 PM
  • Hi Andrei,

    Well, the correct way to use DisplayInformation class is as what you wrote here.

    And I don't think changing the resolution of the screen will affect the dpi, you have to set the dpi manually if you need, then the the DisplayInformation.LogicalDpi will tell you that the DPI has been changed.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, December 16, 2013 3:10 AM
    Moderator

All replies

  • I figured it out but it displays 96 dpi on my PC (1920 x 1080) which is correct but also on my tablet which has the resolution of 1280 x 800 and the dpi should be 125

    Windows.Graphics.Display.DisplayInformation displayInformation = Windows.Graphics.Display.DisplayInformation.GetForCurrentView();
    Int16 a = Convert.ToInt16(displayInformation.LogicalDpi);


    If you don't gain anything from arguing with someone, do yourself a favor and stop wasting your time for free.


    Saturday, December 14, 2013 4:03 PM
  • Hi Andrei,

    Well, the correct way to use DisplayInformation class is as what you wrote here.

    And I don't think changing the resolution of the screen will affect the dpi, you have to set the dpi manually if you need, then the the DisplayInformation.LogicalDpi will tell you that the DPI has been changed.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, December 16, 2013 3:10 AM
    Moderator