Home > .NET 2.0, C# 2.0, Forms 2.0 > Quick and Easy Splash Screen

Quick and Easy Splash Screen

August 2, 2007

Updated: 10 September 2008 – I added some information about using transparent background images.

I have several applications that take a little while to start up, usually because they are establishing database connections. As we all know, if an application takes longer than 2 seconds for a screen to appear, the user will assume nothing has happened and double click the icon again. I’ve watched users practically clicking with fury because they didn’t get immediate results. Hey, maybe that could be a new movie… Clicks of Fury!

Anyway, the way around this is to provide the user a Splash Screen. That is the little icon or graphic that pops up while an application is loading. This gives the user immediate feedback that something is happening, and can provide something interesting or entertaining to fill the void while they wait. OK, the last may be a stretch, but a Splash Screen is important. For users using your software for the first time, it is also their first impression of you and your product.

Today I’m going to show you a really easy way to incorporate a Splash Screen for your application. Just follow these steps…

Create the Splash Image

This step is actually optional, which will make sense in a minute, but you can get much more impressive results using a Graphic for your Splash. You can use just about any standard image type. You can also use irregularly shaped images (with transparent background) to achieve some pretty cool effects.

Create the Splash Form

I usually call mine FormSplash, so that I can always cut and paste the rest of the code from this article into my Main Form. Follow these steps:

  1. Set the FormBorderStyle property to None.
  2. If you created an image in #1 above, set the BackgroundImage property to the image you created. Usually you will also want to set the BackgroundImageLayout property to None. If you chose not to create an image, you can simply set the background color of your form to a color of your choosing and place labels and such on your FormSplash to represent text.
  3. Adjust the FormSplash size to the same size as the Image or to an appropriate size for your Splash.
  4. Set the ShowInTaskbar property to False. This is optional but will prevent an extra item from showing up temporarily and unnecessarily in the task bar.

Your Splash Form is now ready to be used.

Using Transparent Background Images

If you are using a Background Image with an irregular shape expecting the transparent parts to actually be transparent, then at this point you may be a little frustrated.  For instance, I just created a Splash graphic with rounded borders and saved it as an RGB/A PNG file.  When I used it as the background of the Splash Form, you could see the corners as solid Control colored sections.  In other words, the transparency only went from the Background Image to the Form BackColor.  Naturally, I want the transparency to show all the way through to the Desktop.

The way around this was actually pretty simple: there is a property on the Form called TransparencyKey.  Set it to the same color as BackColor.  Now, that color is treated as transparent and the corners no longer show.  It may be a good idea to pick an uncommon color, like Tomato or Bisque (ummm… lunch!) instead of the default Control.

Show the Splash from your Main Form.

Now that you have FormSplash, you need to instantiate and show it from your Main Form. This is almost like any other Form.Show(), but with a little kick:

FormSplash splash = new FormSplash();

The only difference here is the splash.Update() line. This will force the FormSplash to redraw itself immediately, not waiting for the method to finish. I place this code as the first in my Main Form Constructor, immediately preceding the InitializeComponent() call.

Now to finish it all off, just hide the form at the end of the Constructor:


And there you have it: a quick and easy Splash Screen. Now whenever the application is starting, it should show your users a lovely Splash Screen while they wait. And hopefully we can hold off the Clicks of Fury!

Categories: .NET 2.0, C# 2.0, Forms 2.0
  1. Sid
    July 31, 2008 at 2:40 am

    I liked your way of writing! I suggest you will make up a wonderful teacher!!

  2. August 19, 2008 at 3:17 pm

    Very nice. I cant tell you how long I searched for the simplest example of this, and found nothing but over complicated examples, or very bad code. So I thank you for posting something so simple and understandable.

  3. djlion12
    March 21, 2009 at 1:50 pm
  4. Danh
    January 22, 2010 at 2:16 pm

    Thanks, this is great!

    To center it to the main form, add these two lines before Show():

    splash.StartPosition = FormStartPosition.Manual;
    splash.Location = new Point(this.Left + (this.Width / 2 – splash.Width / 2), this.Top + (this.Height / 2 – splash.Height / 2));

  5. R Foreman
    February 3, 2010 at 4:15 am

    Put this in the constructor of the splash class to place the (splash) form dead-center in the middle of the working area of the screen

    this.StartPosition = FormStartPosition.Manual;
    this.Location = new System.Drawing.Point(Screen.PrimaryScreen.WorkingArea.Width / 2 – Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 – Height / 2);

  6. ghasem
    March 29, 2010 at 11:12 am

    tank you, it’s very good article.

  7. Alekline
    June 23, 2010 at 10:51 pm

    Excellent Post !! easy to understand… just a little help for those newbies like me:

    you can use System.Threading.Thread.Sleep(2000); to delay the time that the splash form shows up before is goes away. Your code should be something like this:

    FormSplash splash = new FormSplash();


  8. Abethan
    June 28, 2010 at 3:33 am

    Rather than threads, you can use timer object in .Net also.

  9. kritika
    July 31, 2010 at 9:32 am

    i have tyed the same code but in mine form splash and this error is shown ::error creating window handle
    what can i do?

  10. S Kamonere
    August 26, 2010 at 10:23 am

    Simple and to the point. Great work and thanks a lot

  11. TR
    September 14, 2010 at 9:49 pm

    Excellent article. This really helped save time and money and got the job done. Thanks!

  12. Andy
    October 28, 2010 at 11:32 am

    Nice article.

    Question – I am showing Splash screen to show different status messages for some long processes i run in my App. Sometimes i have to do ALT-TABs to go to some other windows on my taskbar and when i come back to my app, i only see the Splash screen in forefront and not the app in background.
    I am calling different thread to run the Splash screen.

    Please advice,

  13. Juanky
    December 10, 2010 at 3:07 pm

    thanks. Very nice and easy

  14. Sean
    March 1, 2012 at 1:06 pm

    The article says “I usually call mine FormSplash, so that I can always cut and paste the rest of the code from this article into my Main Form”. However, I dont see any code.

    • March 5, 2012 at 10:50 am

      There are a few snippets of code near the bottom – you’ll notice it doesn’t take much.

  15. maria
    February 6, 2013 at 11:49 am

    there is no TransparencyKey in the forms property! like duh??

  1. November 27, 2007 at 1:48 am
  2. January 22, 2010 at 7:32 am
Comments are closed.
%d bloggers like this: