I would like to make a Per-Monitor DPI-Aware Direct2D application. I have extended Microsoft's "First Direct2D Program" example to handle WM_DPICHANGED
as explained in Kenny Kerr's MSDN article. This works when both monitors use one video card, but suffers from a glitch when using my laptop's NVIDIA Optimus setup.
I can reproduce the same glitch by running the Per-Monitor Aware WPF Sample with these steps:
- Different DPI scaling factor on each monitor.
- Optimus enabled (laptop display on integrated graphics, external monitor on Quadro card)
- The app starts on the primary display - the external monitor on the right.
- Drag it over to the left, and it properly handles DPI change.
- Drag it back to the right. When it handles DPI change, the portion of the window on the right monitor becomes black. The portion on the left is still drawn properly.
(See video of this bug)
I have only seen this bug with the above example app, and when I try to add Kerr's WM_DPICHANGED handler to a simpler example. Suspiciously, I have seen other apps (Chrome, Visual Studio itself) show a similar black window, but only temporarily, if I drag between monitors and maximize them very quickly.
So - is anyone familiar with this glitch? Is it some bug in my display drivers? Or is there something other apps do to rectify it, which the example code does not?