all groups > dotnet windows forms > july 2006 >
You're in the

dotnet windows forms

group:

Winform Splash Screen


Winform Splash Screen Angelina
7/31/2006 12:00:00 AM
dotnet windows forms:
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

Re: Winform Splash Screen rhaazy
7/31/2006 7:38:21 AM
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

[quoted text, click to view]
Re: Winform Splash Screen GAZ
7/31/2006 11:58:46 AM
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

[quoted text, click to view]

Re: Winform Splash Screen GAZ
7/31/2006 2:21:27 PM
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

[quoted text, click to view]

Re: Winform Splash Screen Angelina
7/31/2006 6:30:38 PM
But I am using .NET 1.1 :(

[quoted text, click to view]

AddThis Social Bookmark Button