Hi again,
As usual i'll try to keep my code as simple as possible, but just as good i hope =)
Will add screenies later.
First create a new C# project by going to
Now add a new form by right clicking on the project in the solution explorer, and add a new "Windows Form" called "Splash".Code:File>New>C#>Windows Form Application
Now add a timer on the "Splash" form, with its interval set at 3000. You can change that at the timer's Properties.
Now you're gonna have to change your startup form, from Form1, to splash, you can achieve that by editing "Program.cs" code, from
ToCode:using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace Splash_Screen { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }
Now goto Splash's main code, and underCode:using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace Splash_Screen { 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()); } } }
addCode:InitializeComponent();
And add this to "timer1"'s codeCode:timer1.Enabled = true;
Go back to Form1 now, and click the "Events" button (Looks like a lightning icon), and scroll down to "FormClosed", and double click it, it should bring you to the code editor. Now add this codeCode:Form1 MainForm = new Form1; MainForm.Show; timer1.Enabled = false; this.Dispose(false);
The reason behind this is because when Splash closes, its actually still running in the background, but just not visible, as because it is the startup form, which C# thinks is the main form, but by adding this code whenever your Form1 closes the whole application closes.Code:Application.Exit();
Now for the GUI =D
Set "Splash"'s "FormBorderStyle" to "Borderless", and "TopMost" to yes, and "ShowInTaskbar" to no.
Then resize your Splash form to whatever size you like, and add a picture or background, and ur done =)
Hope you found this usefull.
~kierien
Not bad! +rep
You can actually do all of that in the designer, without having to modify the code. The startup form can be made the first form to load in the Project Properties bit (double click it in the Solution Explorer).
It might be nice to include an option to turn off the splash, just in case it gets annoying for the user. But well done still! I can't +rep you because I +repped your other one, it won't let me.
nice tutorial! +rep
keep it up![]()
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
www.amrosama.com | the unholy methods of javascriptCode:eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
I totally agree with Xav. It could and maybe should be done in the designer. But the truth is: the best code is the working one. So please take this -->rep<-- from me as a sign of respect.![]()
proudly presenting my personal website and game website: F1Simulation. a thrilling Managed DirectX racing game... also my Ask Me
look at my tutorials about cropping images and Mono: bundling Mono with programs and lambda expressions
That is false. Working code is the third best code.
The second best code is code that is fast for the coder.
The best code is code that is fast for the user.
In other words, efficient, optimised code. Therefore Kierens' code is only third best code.![]()
wahh...
i had done it!
thanks u so much
+rep point :X
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks