Creating a Winforms 2.0 Splash Screen

What is the easiest way to launch a splash screen (which disappears by itself) in a winforms C # /. NET 2.0 application? It looks like the VisualBasic assembly (which can be called from C # nonetheless) has a way to do this, but are there any simple examples?

thank

+3
source share
2 answers

A detailed Code Project tutorial that puts the splash screen in its own stream, so the main application can work with loading.

+1
source

- , . , , , , 3 , .

. :

    static void ThreadFunc()
    {
        _splash = new Splash();
        _splash.Show();
        while (!_shouldClose)
        {
            Application.DoEvents();
            Thread.Sleep(100);
            if (new Random().Next(1000) < 10)
            {
                _splash.Invoke(new MethodInvoker(_splash.RandomizeText));
            }
        }
        for (int n = 0; n < 18; n++)
        {
            Application.DoEvents();
            Thread.Sleep(60);
        }
        if (_splash != null)
        {
            _splash.Close();
            _splash = null;
        }
    }

, :

    static public void ShowSplash()
    {
        _shouldClose = false;
        Thread t = new Thread(ThreadFunc);
        t.Priority = ThreadPriority.Lowest;
        t.Start();
    }
    internal static void RemoveSplash()
    {
        _shouldClose = true;
    }
0

Source: https://habr.com/ru/post/1770614/


All Articles