2014/04/19

Create your own Splash Screen Programmatically

Programming Language: C#

1-14-2014 9-11-03 PM
In this article, I’ll teach you on how to create your own Splash Screen.




There are already some predefined templates available for C#.net, but if it gives you the difficulty in managing the template you imagined of doing, consider creating a customized Splash Screen for your application. So to do this within C# you need to implement it programmatically.
If you’re in a hurry to learn this, I’ll give you a simple trick.
1-14-2014 8-59-55 PM
Step 1: Access your toolbox properties and then drag the timer object within your form. This will insert the object within the form.
1-14-2014 9-01-30 PM
Step 2: Go to your form’s Designer.cs
There you will see the object being initialized in this section by InitializeComponent().
Now that you’ve prepared everything you need, its time to add an event within the timer you’ve just inserted. In my case the object name is timer1. Feel free to rename it as you wish.
1-14-2014 9-02-13 PM
//type this within Designer.cs of your form
//normally, you can do and initialize this within the Load event of your form
this.Timer1.tick += new System.EventHandler(this.TimerCountdown);

Type the encircled code snippet within the InitializeComponent(). With the help of intellisense thanks to Visual Studio, typing this snippet will be a lot more easy. Note: you should create a TimerCountdown method within your form.cs so that the intellisense can detect it. Or you can simply follow the ones I’ve shown you. TimerCountdown method will be shown later within this article.
1-14-2014 9-03-42 PM
Now within your Load event, start typing the following code snippet within your program. If you followed my instructions so far, you can see a code like this.
1-14-2014 9-04-37 PM
Now, in order to control your splash screen, you need to add a variable that will stop the timer and show your main form. If you’re not sure of your work, you can type the following code snippet within your program.
Bottom line: whether this method of mine is useful to you or not, always remember that you can create or implement your own method of creating your own Splash Screen programmatically. You now have an idea on how to implement a Splash Screen within your C# code.

And that covers it all. Hope you’ve successfully built your own Splash Screen in C#. Happy coding!

No comments: