Create Splash Screen in WPF

来源:互联网 发布:月薪15万的程序员 编辑:程序博客网 时间:2024/05/22 13:36
Method1 :
Just add image in project , and change the build action to "SplashScreen"

Method2:
Change the App.xmal build action to "page" ,and add the main entry point like :
Notice : the xxx .png file build action is resource in current assembly .
        /// <summary>
        /// Application Entry Point.
        /// </summary>
        [STAThreadAttribute()]
        public static void Main()
        {
            SplashScreen ss = new SplashScreen("xxx.png");
            PhotoGallery.App app = new PhotoGallery.App();
            ss.Show(true);   
            app.InitializeComponent();
            app.Run();
            ss.Close();
        }


Caution :

It is important to understand that the Splash Screen has the following limitations:
·         It does not actually improve application cold startup time.
·         Cannot display sequence of splash images or animation.
·         Does not support for animated GIFs
·         Does not support earlier versions of VS (earlier than VS2008 Sp1). You should still be able to use the APIs (e.g. Approach C)

·         Does not support XBAPs (XBAPs already have their own improved coldstart progress page in  .Net 3.5 Sp1)
·         Does not have  XAML support for setting splash screen image
·         Expression Blend does not provide UI to  set the SplashScreen build action
原创粉丝点击