Click here to Skip to main content
15,889,852 members
Articles / Programming Languages / C#
Tip/Trick

Splash Screen Control in WinForm C#

Rate me:
Please Sign up or sign in to vote.
2.33/5 (4 votes)
20 Dec 2014CPOL 24.3K   7   5
Step by step making of splash screen for Windows Form Application

Introduction

Splash Screen Control, using this tutorial, it'll be easy to make an opacitic Splash Screen .

Splash Screen is the screen that you can use as your opening page or closing page with your Company logo of icon, image.

Full Method

By following this point, you can easily make your own.

  1. First open a new WinFrom, and name it Splash Screen.

    Image 1

  2. By default, it will make you an empty Form. By right clicking, you can find properties of that Form.

    Image 2

  3. Make the Form Borderless by selecting Border style None. And Windows Position To Center.

    Image 3

  4. Now take PictureBox and drag it into Form.

    Image 4

  5. Select a picture for this box and dock it with the window, select AnImage for background.

    Image 5

  6. Take 3 Timer Controls from Components Control and drag and drop it into the form.

    Image 6

  7. By double clicking on timer control, add 3 event handlers in your form1 code section.

    Image 7

Using the Code

Now write code as follows:

C#
//

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TailorInventoryAndPos.Properties;
using Timer = System.Threading.Timer;

namespace TailorInventoryAndPos.UI
{
    public partial class StartPage : Form
    {
        private int count = 0, buffer = 0;
        public StartPage()
        {
            InitializeComponent();
            Opacity = 0;
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (Opacity == 1)
            {
                timer2.Start();
                timer1.Stop();
            }
            else
            {
                count++;
                Opacity = count*.05;
            }
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            if (buffer == 3)
            {
                timer3.Start();
                timer2.Stop();
            }
            else
            {
                buffer++;
            }
        }

        private void timer3_Tick(object sender, EventArgs e)
        {
            if (Opacity == 0)
            {
              << Load your another from >>//Optional if you want to load other form
               // this.Hide(); // for loading other form
                timer3.Stop();

                 Application.Exit();
            }
            else
            {
                count--;
                Opacity = count * .05;
            }
        }
    }
}
//

Now build and run your program and watch the magic.

Points of Interest

You can make your own Splash Screen by using this simple method. Feel free to ask any questions.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions

 
QuestionConfusion Pin
kalitzburge3227-Dec-14 2:04
kalitzburge3227-Dec-14 2:04 
AnswerRe: Confusion Pin
Mahfuz Rahman28-Dec-14 7:48
Mahfuz Rahman28-Dec-14 7:48 
QuestionDownload link gives 404 file not found error Pin
Chinatablet23-Dec-14 20:23
professionalChinatablet23-Dec-14 20:23 
GeneralMy vote of 3 Pin
Klaus Luedenscheidt20-Dec-14 18:07
Klaus Luedenscheidt20-Dec-14 18:07 
GeneralRe: My vote of 3 Pin
Mahfuz Rahman21-Dec-14 5:56
Mahfuz Rahman21-Dec-14 5:56 

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.