开发者

How to add a Splash Screen

In my application it takes some time to loan my initial screen(1-2 mins). Since it has so many controls to be filled by Database.

So I need to have a splash screen, it will load(probably with a progress bar) and stays while main form loads. Means in background I need to load main form (better wi开发者_高级运维th out showing)

Only main window finishes loading, it notifies to splash, the splash will go off and main will be visible.

I tried to achieve above with several way but no success.

Any one can help me ?


look at this Splash screen

and this Splash screen class


FormSplash splash = new FormSplash();

this.BeginInvoke(
    new MethodInvoker(
        () =>
        {
            splash.Show();
        }
    )
);

// main form code here

// at end of loading code
splash.Close();

The above code belongs in Form_Load of the main form.


There are a couple of good approaches discussed at Show a splash screen at once (in fact to me this and the other question appear to be duplicates).


The best way and using the API is

  SplashScreen splash = new SplashScreen("splashscreen.jpg");
  splash.Show(false);
  splash.Close(TimeSpan.FromMilliseconds(2));
  InitializeComponent();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜