I have a splash screen for my C# database application that is called via the Shown event. The splash screen contains some information that is preprocessed when the main form's constructor is called, hence why I'm using the Shown event, because that information should be available.
However, when the splash screen is shown, the main form is whited out, and the menu bar, bottom menu bar, and even the gray background are all white and invisible. It looks like the program is hanging, but after the 5 second delay I have built in, the banner goes away and the program is shown normally. Also, on the banner, I have labels that are not shown when the splash screen displays...
Here is my code, some reasoning behind why it isn't working would help greatly.
SPLASH SCREEN CODE :
public partial class StartupBanner : Form
{
public StartupBanner(int missingNum, int expiredNum)
{
InitializeComponent();
missingLabel.Text = missingNum.ToString() + " MISSING POLICIES";
expiredLabel.Text = expiredNum.ToString() + " EXPIRED POLICIES";
}
}
CALLING CODE :
private void MainForm_Shown(object sender, EventArgs e)
{
StartupBanner startup = new StartupBanner(missingPoliciesNum, expiredPoliciesNum);
startup.MdiParent = this;
startup.Show();
Thread.Sleep(5000);
startup.Close();
}
Using startup.ShowDialog() shows the correct label information on the splash screen, but that locks up the application, and I need the splash to go away after about 5 seconds, which is why it's a splash. ;)