简体   繁体   中英

splashscreen loading trouble

for 0->100
                SplashScreen.SetCurrentTitle("Loading " + Math.Ceiling(procent).ToString() + "%");
                //SplashScreen.Instance.Invalidate(); doesn't helps :(
                Application.DoEvents();
                Thread.Sleep(20);

that's splashscreen but I can see only 1->18 and then just wait 18->100 but can't see :(

how to show other 18->100 :)

this ?

        public static BeginDisplay() : void
    {
        Instance.Visible = true;
        unless (Instance.Created)
        {
            Instance.CreateControl();
        }

        _=SetWindowPos(Instance.Handle, (HWND_TOPMOST :> IntPtr), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
        alphaBlend = if(Instance.FadeIn) (15 :> byte) else (255 :> byte);
        Instance.SetBitmap((Instance.BackgroundImage :> Bitmap), alphaBlend);
        when (Instance.FadeIn)
        {
            mutable tmrFade : Timer = Timer();
            tmrFade.Interval = 10;
            tmrFade.Tick += EventHandler(_fadeTick);
            tmrFade.Start();
        }
        Instance.Show();
    }

This probably means that your initialization code performs one long operation thus blocking the message queue. You should do the folllowing:

  1. Instruct the main thread to allow splash screen updates (via DoEvents ). This should be done periodically while performing initialization.
  2. Display the splash screen in an alternate thread and update its status from a dedicated percentage variable set from the primary thread (the one that performs initialization).

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