What is the code to force Windows to refresh the display settings?I have a VB .NET Forms application that has been steadily updated long enough that it has moved through multiple .NET versions and deployed across Windows XP, Windows 7, and now Windows 10 (we were able to avoid Vista and 8).
Now, on Windows 10 running on an HP, I have a display problem. The problem in the HP, but there is a work around that I would like to trigger from the application.
To fix the problem, after launching the app (from DEV or EXE):
1) Dock / Undock (switching between native and attached displays)
2) Open display settings and change something (resolution, scale, etc.)
3) Perform some other, similar display adjustment that requires the OS to update all of the resolution/scaling constants.
In each case, when change the display or display settings, the problem is resolved, and when I change back, things continue to work fine. It also does not matter if I start on the laptop display or the attached displays. I can duplicate the behavior and fix on multiple HPs running windows 10.
What I need is code to force Windows to refresh the display settings.
Background:The problem is clearly in the OS, likely the display driver. However, HP has been having issues with display drivers ever since the rush to market with the Thunderbolt and they have yet to fix most of those problems. HP blames Microsoft, Microsoft blames HP, nothing gets fixed.
Using app level functions, such as Refresh, and PerformAutoScale do not do the trick. The problem appears to be that windows is reporting different values to the application on container size, and usable size. The app initially draws the controls to the correct container size, but then only repaints a smaller usable size.
Making the window smaller (reducing the container size to below the apparent usable size) and then bigger again, does not make the problem go away - there is a fixed "usable size" that the app will not repaint beyond the borders of, even when the container goes beyond that size. What is interesting about this is that the app will update the data in the controls beyond this "usable size" - it just doesn't properly repaint, instead it adds the new text on top of the old text. It also leaves behind the drawn window edges as the container is sized larger.
Another interesting tidbit is that I can run the app, perform the work around to "fix" the problem, and then close the app. Upon reopening the app, the problem returns, and the work around is again required.
Please help with both a code driven work around, or even better, an OS level fix.
1) VB .NET in Visual Studio 2017 (version 15.9.16)
2) Windows 10 (up to date per Microsoft)
3) HP ZBook Mobile Workstation "Bang & Olufsen" with i7, lots of memory (has no problem with Solid Works 2017)
4) Display drivers for both laptop internal, and Thunderbolt dock external up to date
5) Behavior duplicated on second HP (same config) with Windows 10; same app continues to run just peachy on second HO (same config) running Windows 7.