Winform Splash Screen

A

Angelina

What is the best practice to create a splash screen in .net winforms
applications so that the splash screen loads immediately after we start
application and closes when all dlls loading and initializations is
completed. I don't want any idle situation to be seen by the user.

Currently I have created a form and set it visible at start and close it
after I call application.run for my main form. The problem is that splash
screen appears after 2-5 seconds of starting the application and close
immediately.


- Angelina
 
G

GAZ

Unless you have some major and lengthy operations to set up your application
environment the splash screen will close almost immediately. In any case
quite a number of dlls have to be already loaded in order to show the splash
form, hence.....

In VS2005 (if I remember correctly you use VS2003) there is a SplashScreen
item that you can add to your solution and set your application to show it
when it's starting-up. However, it closes down almost immediately after you
start the application.

You have to create some form of delay on your splash screen in order to have
it shown for a longer period of time. Try with the timer control and set the
delay for five seconds.

BR,

GAZ
 
G

GAZ

With an addition. There is a My.Application.MinimumSplashScreenDispleyTime
property through which you can set up the amount of time the splash screen
stays visible.

BR,

GAZ
 
A

Angelina

But I am using .NET 1.1 :(

GAZ said:
With an addition. There is a My.Application.MinimumSplashScreenDispleyTime
property through which you can set up the amount of time the splash screen
stays visible.

BR,

GAZ
 
R

rhaazy

You should use a main class and call all of your forms from that, so
something like this:

public class clsMain
{
public clsMain()
{
//
// TODO: Add constructor logic here
//
}

[STAThread]
static void Main()
{
frmSplash objfrmSplash = new frmSplash();
objfrmSplash.ShowDialog();
clsGlobal.g_objfrmMDIMain = new frmMDIMain();
Application.Run(clsGlobal.g_objfrmMDIMain);
}
//This is the Single Threaded Apartment Model(out of our scope) of the
application which will run the Main function
//when the application starts
}
on your splash screen form place a timer that closes the form after a
few seconds.
(Note:) dont forget to remove the main class from the form that may
already be your main form.

/// <summary>
/// The main entry point for the application.
/// </summary>
//[STAThread]
//static void Main()
//{
// Application.Run(new Form1());
//}
//because we cannot have two Main function.We are invoking everything
from clsMain
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top