简体   繁体   中英

Creating splashscreen without creating multi-threading form

I want to make a splash screen without creating multi-threading on the application does anybody have any idea to create splash screen that will automatically show the next form?

I have trying this timer_tick and creating object to showdialog for the next form but it doesn't work properly.

Try something like this:

public partial class FormTicker : Form
{
    Timer timer;
    public FormTicker()
    {
        timer = new Timer();
        InitializeComponent();
        timer.Interval = 2000;
        timer.Tick += new EventHandler(timer_Tick);
        timer.Start();
    }

    void timer_Tick(object sender, EventArgs e)
    {
        timer.Stop();
        FormMain formMain = new FormMain();
        formMain.Show();
        this.Hide();
    }
}

Visual Basic has support for splash screens that you can take advantage of by referencing Microsoft.VisualBasic in your c# project.

An example can be found at Splash screen doesn't hide - using Microsoft.VisualBasic library

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM