tags:

views:

31

answers:

1
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();
    }
+2  A: 

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).
Kerido
2 > 1. Application.DoEvents() nearly never is a good idea.
Femaref
@Femaref, you're definitely right. But from what I saw in the source code of the question, it is too early for the guy to dive into multi-threading. @nCdy, no offense
Kerido
But I'm making doEvents... don't know if I can make it in new thread :P btw that's awesome code >_< but doEvents doesn't helps here . . . where I must to add it ... ?
nCdy
@nCdy, yes you are. But your initialization code is the one that is blocking the splash screen. Could you provide it also so that a clearer suggestion could be thought of?
Kerido
initialization code ? this (on first post)
nCdy