none
[UWP]DisplayMonitor: get monitors' ResolutionScale RRS feed

  • Question

  • Hi, My name is Ngo Dinh Khoi. I'm developing an uwp application which can show text on secondary display. I could use DisplayMonitor to get all display devices' information, except the resolution scale and logical dpi. So, How can I access those information?

    Thanks for your help!


    Sunday, September 15, 2019 8:55 AM

Answers

  • Hi,

    Once you move your app to another screen, DisplayInformation properties will start returning values for that given screen.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by David K Ngo Monday, September 16, 2019 3:39 PM
    Monday, September 16, 2019 10:18 AM
    Moderator

All replies

  • Hi,

    You could use DisplayInformation.LogicalDpi Property and DisplayInformation.RawPixelsPerViewPixel Property to get the resolution scale and logical dpi. 

    Like this:

                //get scale
                var scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
                //get logical dpi
                var LogicalDpi = DisplayInformation.GetForCurrentView().LogicalDpi;
                //get scaled app size in the monitor
                var bounds = ApplicationView.GetForCurrentView().VisibleBounds;
                var size = new Size(bounds.Width * scaleFactor, bounds.Height * scaleFactor);

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 16, 2019 1:22 AM
    Moderator
  • Hi,

    Thank for answering my question. I have already done that. But I can only get the scale factor of the primary screen. Problem is that I want to get scale factor of other screens. Is there any way to do that?

    Thank you!


    • Edited by David K Ngo Monday, September 16, 2019 7:28 AM
    Monday, September 16, 2019 7:27 AM
  • Hi,

    Once you move your app to another screen, DisplayInformation properties will start returning values for that given screen.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by David K Ngo Monday, September 16, 2019 3:39 PM
    Monday, September 16, 2019 10:18 AM
    Moderator