简体   繁体   中英

WPF SplashScreen using external image

I need to make my SplashScreen show image from hard drive (since i will use several images, which may be changed outside of project). But WPF SplashScreen accepts only resource files, present in this or another assembly.

So, how can i solve it? Maybe, there is some way to create temporary resource file during runtime?

The best way to accomplish this goal is to not use the splash screen feature at all.

Create a new XAML window and size it to the size you want your splash screen to be. You can then use to reference the image you'd like to. This can also be done from code-behind now when loading.

When you're ready, have your main window launch the splash screen as the first thing it does. Let it load everything you need, and then show the main window and close the splash screen window.

This way you have full control over your "splash screen" because it's just another window that you're loading.

The one downside of this is that it might have a very small (.5 second or so) delay because WPF has to load before the window can show. An actual splashscreen is not WPF so it will show immediately. This has never been an issue for me.

我认为这无法按您希望的方式进行,但是,可以创建一个单独的程序集,可以使用以下方法随时将其更改为包含资源的程序集:

SpashScreen(Assembly, string);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM