I have a splash screen for my C # database application that fires through the Shown event. The splash screen contains some information that is pre-processed when the main form constructor is called, so I use the Shown event because this information should be available.
However, when the splash screen is displayed, the main form is crossed out, and the menu bar, lower 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 that I built in, the banner leaves and the program displays normally. In addition, on the banner I have tags that are not displayed when the splash screen is displayed ...
Here is my code, some arguments in favor of why it doesn't work will help a lot.
CLUTCH CONTENT 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 information about the shortcuts on the splash screen, but this blocks the application, and I need the splash to go away after about 5 seconds, and that's why it's a splash .;)
source
share