I am trying to make the splash screen appears first and after the splash, the MainForm
appears. But the progress bar which I have in splash screen don't get to the end of the bar. And the program continues running and not works.
How can I show the splash screen during loading the main form?
My code It's something like that :
public partial class SplashForm : Form
{
public SplashForm()
{
InitializeComponent();
}
private void SplashForm_Load(object sender, EventArgs e)
{
timer1.Enabled = true;
timer1.Start();
timer1.Interval = 1000;
progressBar1.Maximum = 10;
timer1.Tick += new EventHandler(timer1_Tick);
}
public void timer1_Tick(object sender, EventArgs e)
{
if (progressBar1.Value != 10)
{
progressBar1.Value++;
}
else
{
timer1.Stop();
Application.Exit();
}
}
}
Here are the first part of the code of the MainForm
:
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
Application.Run(new SplashForm());
}
}
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…