locked
About the DpiChanged event not work ?

    Question

  • Hi,about the  DisplayInformation class, has a DpiChanged event in window8.1, In the remarks, it mentioned "  DpiChanged is triggered when either the LogicalDpi or ResolutionScale property changes because a user selected a different zoom level or changed the screen resolution."But I find a problem, when I changed the screen resolution from 1024*768 to 1366*768 ,or from 1366*768 to 1024*768, the DpiChanged event no response .But when I changed it from 1024*768 to 1280*720, and from 1280*720 to 1366*768,it all works normally. I want to know why ?                                                                                   Thanks!
    Friday, December 06, 2013 10:24 AM

Answers

  • The DpiChanged event triggers only if the LogicalDpi or ResolutionScale properties change. The user actions listed in the docs may cause this change and therefore trigger the event, but it may not if the change is small enough. In your case, it's not changing the underlying DPI properties and so doesn't fire the changed event.

    For your case ("get the event when I  changed the screen resolution in windows 8.1") size changes are the appropriate event, not DPI changes. As you note, this will detect window size changes. There is no explicit screen size change event.

    --Rob

    Sunday, December 08, 2013 8:20 PM
    Owner

All replies

  • That is probably correct. The changes you made are minor and will mostly all use the same minimum scaling level, so you don't get a change notification for no change.

    Changing the dimensions of the screen doesn't necessarily change the DPI. That is a combination of the pixel dimensions and the screen size. Where you'll see a change is when you run high numbers of pixels on a small physical screen. Compare 1080p on a 10" screen and on a 20" screen.

    This is why the simulator has choices for the same x by y pixels at different simulated sizes.

    Friday, December 06, 2013 2:44 PM
    Owner
  • Question                    
    您不能对您自己的帖子投票 Thansks!

    But about the DisplayInformation  class, please see the link :  http://msdn.microsoft.com/en-us/library/windows/apps/windows.graphics.display.displayinformation.aspx In the Remarks part,"DpiChanged is triggered when either the LogicalDpi or ResolutionScale property changes because a user selected a different zoom level or changed the screen resolution." It mentioned here that change the resolution will response this event yet ?I understand when change the resolution the LogicalDpi doesn't nessarily changed, but sometimes RawDpiX   or RawDpiY   changed,and  it triggered the DpiChanged  event.So when I changed resolution from 1366*768 to 124*768, these values don't change.   Indeed, I want to get the event when I  changed the screen resolution in windows 8.1.   I know if I use window.onresize = onresize; it will response.But it also will response when the app  change to any size.so use the resize event is inaccurate.Is any other ways about this?  

    Sunday, December 08, 2013 3:14 AM
  • The DpiChanged event triggers only if the LogicalDpi or ResolutionScale properties change. The user actions listed in the docs may cause this change and therefore trigger the event, but it may not if the change is small enough. In your case, it's not changing the underlying DPI properties and so doesn't fire the changed event.

    For your case ("get the event when I  changed the screen resolution in windows 8.1") size changes are the appropriate event, not DPI changes. As you note, this will detect window size changes. There is no explicit screen size change event.

    --Rob

    Sunday, December 08, 2013 8:20 PM
    Owner