The best way to achieve this is to run the animation in the async task, but, accordingly, some restrictions can be made in the form of a window using:
System.Threading.Thread.Sleep(int milliseconds) .
My popup is displayed using gif (loading)
For example: in your constructor
public partial class MainMenu : Form { private SplashScreen splash = new SplashScreen(); public MainMenu () { InitializeComponent(); Task.Factory.StartNew(() => { splash.ShowDialog(); }); Thread.Sleep(2000); }
Be sure to put Thread.Sleep(int) after starting a new one, do not forget that every action you did in this thread should be called, for example:
void CloseSplash() { Invoke(new MethodInvoker(() => { splash.Close(); })); }
Now your gif should work!
source share