Page 1 of 1

How to Make a Splash screen

#1 X@MPP  Icon User is offline

  • 僕わ馬鹿ですね?
  • member icon

Reputation: 36
  • View blog
  • Posts: 1,014
  • Joined: 20-February 09

Posted 14 March 2009 - 03:20 PM

OK, this is my tutorial on how to make a simple splash screen for a Windows Form application.

First, start by opening Visual Studio 2008 or C# Express 2008 and create a new Windows Form App Project in C#. You can call it whatever you'd like; I just used SplashScreen.

Now add a new Windows Form named SplashScreen to this project.

You should now have 2 forms; the automatically-created main form, which by default should be called Form1, and another form called SplashScreen. In the designer, click on your new form. You should be able to see the Properties Window (usually in the lower right corner of the IDE). In that window find the following properties and set them:

ControlBox to False
FormBorderStyle to None

The rest of the properties should look like this:

Attached Image

The form in the designer should now be nothing but a plain box.

Customize the Splash screen to your liking and add a timer by dragging a Timer from the Toolbox's Component section and dropping it on the SplashScreen form. This should add a timer object, named timer1, to the form and open up the Timer's Properties Window in the IDE. Set the timer's Enabled property to True and the Interval setting to however long you'd like your splash screen to stay open (the unit of measure is milliseconds, so choose the number of seconds you'd like and multiply by 1000). I use 1000 to 3000 for the value.

Next we need to add the Tick event, which is the event that is raised when the timer's interval has elapsed. The easiest way to do this is to click the little lightning bolt icon in the timer's Properties box, which brings up the events that are exposed by the timer object. Double-click in the empty box next to Tick to add the event to the SplashScreen class and load the empty event handler code in the IDE's main window. As a splash screen, the only thing we want to happen when the timer expires is to close ourselves, so add this.Close(); to the generated timer1_Tick() method:

private void timer1_Tick(object sender, EventArgs e)
{
    // Close the splashscreen
    this.Close();
}


Finally, we need to integrate the SplashScreen class into our application. We will do this by adding code to the main form's Load event to create the SplashScreen class and show the window.

First bring up the main form GUI in the IDE's main window and click it to show the form's Properties box. We need to add our code to the form's Load event, so again click on the lightning bolt to bring up the available events for the main form and find the Load event. Double-click on the empty box next to the Load event to create (or edit, if it already exists) the Form1_Load() event handler. Add the following code to the event handler:

private void Form1_Load(object sender, EventArgs e)
{
    SplashScreen Splash = new SplashScreen();
    Splash.Show();
}



Go back to the Properties of Form1 and change the StartPosition property to CenterScreen so that the splash screen will cover it.

That's it!

Is This A Good Question/Topic? 3
  • +

Replies To: How to Make a Splash screen

#2 zahur  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 1
  • Joined: 02-May 09

Posted 02 May 2009 - 10:22 AM

Thanks alot for the contribution...
Was This Post Helpful? 1
  • +
  • -

#3 X@MPP  Icon User is offline

  • 僕わ馬鹿ですね?
  • member icon

Reputation: 36
  • View blog
  • Posts: 1,014
  • Joined: 20-February 09

Posted 02 May 2009 - 12:44 PM

View Postzahur, on 2 May, 2009 - 09:22 AM, said:

Thanks alot for the contribution...

thanx
Was This Post Helpful? 0
  • +
  • -

#4 dExIT  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 16-May 09

Posted 16 May 2009 - 11:11 AM

i red the whole thing, but i cant still seem to understand, how can i make the splashScreen a .gif ( i have the GIf and its Transparent ) ?
Was This Post Helpful? 0
  • +
  • -

#5 ddrose  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 1
  • Joined: 06-April 09

Posted 17 June 2009 - 09:56 AM

Thank You!!! Simple and effective :^:
Was This Post Helpful? 1
  • +
  • -

#6 praneeshpeeyar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 19-July 08

Posted 17 June 2009 - 10:38 AM

thanks.... Good One....!
Was This Post Helpful? 0
  • +
  • -

#7 geekhelp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 12-July 09

Posted 12 July 2009 - 06:20 PM

View PostdExIT, on 16 May, 2009 - 10:11 AM, said:

i red the whole thing, but i cant still seem to understand, how can i make the splashScreen a .gif ( i have the GIf and its Transparent ) ?



In the new windows form, make a new picture box, put your picture in, and resize to your liking.
Was This Post Helpful? 0
  • +
  • -

#8 carck3r  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-March 09

Posted 26 July 2009 - 08:55 AM

SplashScreen splash = new SplashScreen();
			splash.Show(); // show
			Thread.Sleep(3000); // sleep main thread for 3 seconds
			splash.Close(); // close splash screen

It's easier way to show splash screen.
Was This Post Helpful? 0
  • +
  • -

#9 X@MPP  Icon User is offline

  • 僕わ馬鹿ですね?
  • member icon

Reputation: 36
  • View blog
  • Posts: 1,014
  • Joined: 20-February 09

Posted 26 July 2009 - 01:17 PM

View Postcarck3r, on 26 Jul, 2009 - 07:55 AM, said:

SplashScreen splash = new SplashScreen();
			splash.Show(); // show
			Thread.Sleep(3000); // sleep main thread for 3 seconds
			splash.Close(); // close splash screen

It's easier way to show splash screen.

ya im working on a lot now but i will make a new tut for an more advanced splash screen
Was This Post Helpful? 0
  • +
  • -

#10 sudhakara.tp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-July 13

Posted 19 July 2013 - 09:05 PM

the above works, only thing is you need to add Splash.Refresh() after Splash.show(), for the controls in splash screen to be displayed.
Was This Post Helpful? 0
  • +
  • -

#11 hellism  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-July 13

Posted 22 July 2013 - 12:22 AM

I followed exactly what you did but facing 2 same errors. Don't know why and I'm new to C#
Those errors looks like this:

'SplashScreen' is a 'namespace' but is used like a 'type'

Help Please ! :)
Was This Post Helpful? 0
  • +
  • -

#12 charles1990  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 20-June 14

Posted 25 June 2014 - 05:49 AM

View Posthellism, on 22 July 2013 - 12:22 AM, said:

I followed exactly what you did but facing 2 same errors. Don't know why and I'm new to C#
Those errors looks like this:

'SplashScreen' is a 'namespace' but is used like a 'type'

Help Please ! :)/>

Use this Splashscreen splash = new splashscreen(); splash.Show(); don't use splashscreen as splash.show. Because it is a name space.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1