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.
Step 1: Access your toolbox properties and then drag the timer object within your form. This will insert the object within the form.
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.
//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.
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.
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:
Post a Comment