Click here to Skip to main content
11,488,877 members (74,071 online)
Click here to Skip to main content

Office 2013 Style Splash Screen

, 5 Aug 2014 Ms-PL 8.8K 3K 30
Rate this:
Please Sign up or sign in to vote.
How to create Office 2013 style splash screen for Windows Forms

Sample Image - maximum width is 600 pixels

Introduction

Many produce programs that are similar to the user interface of renowned Microsoft Office. Many ribbon, skin and other controls are made from a variety of platforms (WPF, Windows Forms, Active X) Microsoft Office model. I am writing about this because I have not seen a lot of these.

How to create Office 2013 style splash screen for Windows Forms? I present the step by step procedure below.

Step 1: Create the Project

Crerate New Project

Create a new Windows Forms application in Visual Studio. Download Metro ProgressBar, and the blue splash background. Create new Windows Forms to your project (Click „Project”->”Add Windows Form...”).

Step 2: Configure Splash Screen Form

Select the new Windows Forms window, set the "FormBorderStyle" property to "None". Select blue splash image to "BackgroundImage". You can use red (than the PowerPoint), green (than the Excel and the Publisher) or own colour background. Minimum and maximum size: width: 439, Height: 248.

Set properties

Step 3: Create the Controls

It should look like:

Create the controls

Step 4: Write the Code

The Program.cs is as follows:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Office2013StyleSplashScreen
{
    static class Program
    {
        /// 
        /// <summary> 
        /// The main entry point for the application. 
        /// </summary>

        [STAThread] static void Main() 
        { 
            Application.EnableVisualStyles(); 
            Application.SetCompatibleTextRenderingDefault(false); 
            Application.Run(new Splash()); 
        } 
    } 
}

The splash form source code is as follows:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading.Tasks;
using System.Threading;

namespace Office2013StyleSplashScreen
{
    public partial class Splash : Form
    {
        public Splash()
        {
            InitializeComponent();

            //Tasks
            //Starting
            tasks.Text = "Starting...";
            Thread.Sleep(1000);                   

            //start timer
            splashtime.Start();
        }

        public bool Isminimized = false;

        //Close Application
        private void close_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        //Minimize Application
        private void minimize_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
            Isminimized = true;
        }
        //Mouse hover and leave effects
        private void close_MouseHover(object sender, EventArgs e)
        {
            close.ForeColor = Color.Silver;
        }

        private void close_MouseLeave(object sender, EventArgs e)
        {
            close.ForeColor = Color.White;
        }

        private void minimize_MouseHover(object sender, EventArgs e)
        {
            minimize.ForeColor = Color.Silver;
        }

        private void minimize_MouseLeave(object sender, EventArgs e)
        {
            minimize.ForeColor = Color.White;
        }

        //Show MainForm(Form1)
        public void frmNewFormThread()
        {
            var frmNewForm = new Form1();
            if(Isminimized == true)
            {
                frmNewForm.WindowState = FormWindowState.Minimized;
            }
            else
            {
                frmNewForm.WindowState = FormWindowState.Maximized;
            }
            Application.Run(frmNewForm);
        }

        private void splashtime_Tick(object sender, EventArgs e)
        {
            splashtime.Stop();

            var newThread = new System.Threading.Thread(frmNewFormThread);
            newThread.SetApartmentState(System.Threading.ApartmentState.STA);
            newThread.Start();
            this.Close();
        }            
        }
}

I use this.Close(); method to close splash screen, therefore create new Task to start application general window. Set the thread apartmentstate to STA(newThread.SetApartmentState(System.Threading.ApartmentState.STA);).

You can see the related documentation by clicking on the link below:

The Final Result

The Microsoft Office Word splash screen(left) and My splash screen(right), almost same!

Microsoft Office Word splash My splashscreen

History

Not all programs have splash screen. But if you need or want it to look good, I've done this. I hope that this will be useful for your program!

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

Share

About the Author

Magyar András
Student
Hungary Hungary
No Biography provided
Follow on   Google+

Comments and Discussions

 
QuestionReally cool splash screen Pin
AllenR13-Aug-14 10:15
memberAllenR13-Aug-14 10:15 
Questionazmazing Pin
tjnapster55510-Aug-14 0:03
membertjnapster55510-Aug-14 0:03 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 5 Aug 2014
Article Copyright 2014 by Magyar András
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid