WPF Window objects are blacked out on second screen in Windows 10

天大地大妈咪最大 提交于 2021-02-19 05:38:16

问题


Forgive me if this is a technical issue rather than a software-programming one, but I am having difficulty determining the probable cause here, be it the .NET Framework or something lower level, perhaps graphics hardware. Essentially, no WPF application will run on a second monitor using my Windows 10 Alienware 13 laptop. The same application, on the same monitor, running under my Windows 8 Alienware 15, will work fine. Visual Studio 2015 is a similar case, if there might be a common factor. Any experience with this sort of issue would be appreciated


回答1:


For me, the issue seems to be in the hardware acceleration in WPF applications, as disabling it made it impossible to reproduce the problem (which previously I had no trouble doing using winkey+arrows to move WPF from primary to secondary screen)

The following registry edit can be used to disable hardware acceleration inside WPF applications:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Avalon.Graphics]
"DisableHWAcceleration"=dword:00000001

Sources:

https://support.microsoft.com/en-us/kb/963021

https://msdn.microsoft.com/en-us/library/aa970912.aspx




回答2:


Disabling hardware acceleration for the application, worked for me. This can be executed at any point and works immediately. So you can call this when the wpf app is already running

RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;

Microsoft manual




回答3:


I faced the same problem with my Windows 10 and dual monitor ( laptop screen + second monitor connected by HDMI ).

The solution in my case to fix the "black window in the second monitor" was this:

Locate your graphic-card vendor configuration interface by right clicking your desktop. In this pop-up menu you will find something like "Intel graphics" or "nVidia configuration", "AMD Control center", etc...

Find the "scaling options" and change the value. I disabled the "scaling" (OFF) and the problem was fixed, so this issue is related with the auto-scaling of the windows when you move your application between screens.

Please find these screenshots as example from my computer:

Source: https://answers.microsoft.com/en-us/windows/forum/windows_10-start/dual-monitor-different-resolutions-black-program/58ec488a-b62d-4ce8-a058-5e01e2a54d9a



来源:https://stackoverflow.com/questions/36775917/wpf-window-objects-are-blacked-out-on-second-screen-in-windows-10

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!