dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.08k stars 1.17k forks source link

WPF Splashscreen doesn't work correctly on monitors with different dpi's #5070

Open james1301 opened 3 years ago

james1301 commented 3 years ago

Default SplashScreen image appears initially at wrong dpi in the center of the screen. It it then corrects the DPI and then is no longer in the center of the screen. So on a DPI higher than 100%, it appears to shrink and move off center.

Actual behavior:

SplashScreen appears at wrong DPI and then corrects itself (shrinks) and is moved off center.

Expected behavior:

SplashScreen appears at correct DPI and remains in the center of the screen.

Minimal repro:

  1. Using a monitor that is set at a DPI higher than 100% (I was using 250%)
  2. Create a Net Framework 5.0 WPF Application
  3. Add an Image to the project
  4. Set the Properties of the Image to BuildAction = SplashScreen
  5. Run Application and you will see it initially in the center of the screen at a larger non-DPI aware size and then move of center when it is corrected to the DPI aware size

Attached Sample: SplashScreenProblem.zip

lindexi commented 3 years ago

Maybe Duplicated : #3060 #2942 #947

Link: #2031

james1301 commented 3 years ago

Similar to those and I'm sure sorting those would probably sort this too. But this one is definitely a bug in .NET compared to it working consistently in .NET Framework. It's unusable as is, DPI aware or not DPI aware would be acceptable to me, just not trying to do a bit of both while it loads up, that is the best of no worlds.

ryalanms commented 3 years ago

Hi @james1301,

Were you able to test this on 4.8? Thanks.

james1301 commented 3 years ago

@ryalanms, yeah I tested it and it was fine on .NET Framework 4.8.

james1301 commented 1 year ago

@ryalanms, @lindexi has anything happened with this?

lindexi commented 1 year ago

@james1301 Now I use https://github.com/kkwpsv/SplashImage . See https://github.com/dotnet/wpf/issues/2031

james1301 commented 1 year ago

Thanks @lindexi, but there doesn't seem much activity on that GitHub, we use very few third party libraries and the ones we do use need a certain level of popularity and support for us to consider using them so we know they should be all good for the future and hopefully well tested.