Click here to Skip to main content
15,397,385 members
Articles / Desktop Programming / Windows Forms
Posted 17 Feb 2005


119 bookmarked

SplashForm - A Splash Window Form

Rate me:
Please Sign up or sign in to vote.
4.54/5 (21 votes)
17 Feb 20052 min read
This article is about a class that extends Windows Forms to create splash screens and About dialogs.

Image 1


I had written an article CSplash - A Splash Window Class about displaying splash screens using Win32 APIs. This article is about how the same thing is accomplished in .NET framework. This form can also be used for About dialogs.

Preparing the Image

First, create the image you would like to show as the splash, in your favorite image editor. Then choose the part of the image you would not like to be rendered on the screen, and give it a particular color that does not occur anywhere else on the image. For an example, if your image is a red disc with some logo or text inside it in blue, then fill all the region outside the circle with a color like green (anything other than red and blue).

Using SplashForm

The interface of the class is very simple. At the start of your application, call the static method StartSplash and specify the bitmap file path and the color on it to be made transparent. This creates and shows the splash form in a new thread so that control immediately returns to your application and it can proceed with other initialization.

using System;
using Abhinaba.Splasher;
using System.Drawing;

        Color.FromArgb(128, 128, 128));

Once all initialization is complete, call the static method CloseSplash to close the splash form.


To show the splash screen as an About dialog, use the ShowModal method.

             Color.FromArgb(128, 128, 128));

Under the hood

In StartSplash, a new thread is created which calls the method MySplashThreadFunc.

// Create and Start the splash thread
Thread InstanceCaller = new Thread(new ThreadStart(MySplashThreadFunc));

This method creates the splash form and shows it in a new thread.

private static void MySplashThreadFunc()
    m_instance = new SplashForm(m_imageFile, m_transColor);
    m_instance.TopMost = false;

The splash form constructor then prepares the form for transparency and then loads the image:

public SplashForm(String imageFile, Color col)
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
    this.ShowInTaskbar = false;
    this.TopMost = true;

    // make form transparent
    this.TransparencyKey = this.BackColor;

    // tie up the events
    // load and make the bitmap transparent
    m_bmp = new Bitmap(imageFile);

    // resize the form to the size of the iamge
    this.Width = m_bmp.Width;
    this.Height = m_bmp.Height;

    // center the form
    this.StartPosition = 

    // thread handling. Used because the window
    // will be closed from a different thread
    m_delegateClose = new DelegateCloseSplash(InternalCloseSplash);}

On the Paint event, the loaded image is displayed.

private void SplashForm_Paint(object sender, 
               System.Windows.Forms.PaintEventArgs e)
    e.Graphics.DrawImage(m_bmp, 0,0);

To close the form, the CloseSplash method must be called. The splash form has been created and is running in a different thread. So it is not possible to directly call Close on it. For this, the following code is used:

public delegate void DelegateCloseSplash();
private DelegateCloseSplash m_delegateClose;

public SplashForm(String imageFile, Color col)
    // ...
    m_delegateClose = new DelegateCloseSplash(InternalCloseSplash);
    // ...

public static void CloseSplash()


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
United States United States
I just love coding. I started programming in 1995 with BASIC and then moved through Cobol, Pascal, Prolog, C, C++, VB, VC++ and now C#/.NET.

I received a Bachelor of Technology degree in Computer Science from University of Calcutta in 2001.

I worked for some time in Texas Instruments, Adobe Systems and now in Microsoft India Development Center in the Visual Studio Team Systems.

I am from the City of Joy, Kolkata in India, but now live and code Hyderabad.

Comments and Discussions

Questionstill working well Pin
Southmountain27-Mar-22 15:01
MemberSouthmountain27-Mar-22 15:01 
GeneralHmmm... Pin
damir_tk1-Jun-08 10:48
Memberdamir_tk1-Jun-08 10:48 
GeneralTried ShowModal() Pin
lmdarif11-Oct-07 11:00
Memberlmdarif11-Oct-07 11:00 
GeneralMinor simplification - MethodInvoker delegate Pin
Zoodor20-Sep-07 22:22
MemberZoodor20-Sep-07 22:22 
GeneralRe: Minor simplification - MethodInvoker delegate Pin
CharlesLentz24-Oct-08 6:05
MemberCharlesLentz24-Oct-08 6:05 
GeneralSolving a small bug in the code... Pin
boodi_813-Aug-07 1:36
Memberboodi_813-Aug-07 1:36 
GeneralReally Nice Pin
Ricardo Casquete26-Jan-07 5:47
MemberRicardo Casquete26-Jan-07 5:47 
GeneralRe: Really Nice Pin
CharlesLentz24-Oct-08 7:10
MemberCharlesLentz24-Oct-08 7:10 
Generalfocus on main Pin
Daniel Ahumada3-Feb-06 9:48
MemberDaniel Ahumada3-Feb-06 9:48 
GeneralRe: focus on main Pin
abhinaba4-Feb-06 5:53
Memberabhinaba4-Feb-06 5:53 
GeneralRe: focus on main Pin
Daniel Ahumada23-Feb-06 5:08
MemberDaniel Ahumada23-Feb-06 5:08 
AnswerRe: focus on main Pin
gfkeogh24-Jul-06 18:29
Membergfkeogh24-Jul-06 18:29 
AnswerRe: focus on main Pin
CharlesLentz24-Oct-08 7:09
MemberCharlesLentz24-Oct-08 7:09 
GeneralUsing application ressources Pin
mgroeschel13-Jan-06 5:15
Membermgroeschel13-Jan-06 5:15 
Questionhow to connect with my project Pin
Muhnad11-Jan-06 13:54
MemberMuhnad11-Jan-06 13:54 
GeneralTransparency doesn't work under W98 Pin
Dave Midgley31-Dec-05 5:42
MemberDave Midgley31-Dec-05 5:42 
GeneralRe: Transparency doesn't work under W98 Pin
Colin Angus Mackay31-Dec-05 7:25
MemberColin Angus Mackay31-Dec-05 7:25 
GeneralRe: Transparency doesn't work under W98 Pin
abhinaba31-Dec-05 9:11
Memberabhinaba31-Dec-05 9:11 
GeneralConstructor should be private Pin
Dave Midgley31-Dec-05 2:10
MemberDave Midgley31-Dec-05 2:10 
GeneralRe: Constructor should be private Pin
abhinaba31-Dec-05 9:07
Memberabhinaba31-Dec-05 9:07 
GeneralRe: Constructor should be private Pin
Dave Midgley2-Jan-06 23:08
MemberDave Midgley2-Jan-06 23:08 
GeneralRe: Constructor should be private Pin
abhinaba4-Jan-06 2:50
Memberabhinaba4-Jan-06 2:50 
Questionworks on other VC++ ? Pin
fabteston26-Feb-05 23:36
Memberfabteston26-Feb-05 23:36 
AnswerRe: works on other VC++ ? Pin
abhinaba27-Feb-05 4:21
Memberabhinaba27-Feb-05 4:21 
Generalnice, but... Pin
Anonymous17-Feb-05 2:26
MemberAnonymous17-Feb-05 2:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.