Irritating Flicker Upon Startup

I've built a WinForms app in C#. The basic startup screen is similar to that of MS Word, albeit with a gradient blue background.

I just added a Splash screen. It runs on a separate thread and simply displays a borderless form at the center of the screen. It fades in, the main screen appears behind it, and it fades out, leaving the main screen. That's all fine.

But what's not is that the main screen now has an irritating flicker of sorts when it appears with the Splash screen in front of it. It never used to do this.

What's causing this and how can I prevent it from happening


Robert Werner
http://PocketPollster.com



Answer this question

Irritating Flicker Upon Startup

  • Xaid

    Try double buffering the forms.

  • Sathyashankar

    A bit of a guess and I haven't tried it but this may have something to do with the way Windows implements transparent forms. Before painting such a form, it has to make sure that the windows behind the form are fully painted so that it can combine the background and foreground together to simulate the effect of transparency. To make sure of that, it probably forces those windows to be fully painted, causing your main form to flicker.

    As a workaround, consider *not* showing your main form until you're ready to get going and dismiss the splash screen...


  • JEP8979

    Hmmm, interesting ideas folks. I first tried the 0.99 method but unfortunately this didn't fix it. Then I implemented double-buffering ... at least the "poor man's way" that I know how to do it:

    // Activates double buffering - necessary to avoid flicker
    SetStyle(ControlStyles.UserPaint, true);
    SetStyle(ControlStyles.AllPaintingInWmPaint, true);
    SetStyle(ControlStyles.DoubleBuffer, true);


    But this didn't fix it either.

    Any other ideas ... or is there a more sophisticated way to implement double-buffering

    Robert

  • Dunce Hat

    For some reason that's an unknown problem when using the opacity feature of the form and it's on top of another form.
  • paso

    I too am getting flickering. However, I'm using another thread to add items to a control on my form; but only that control is flickering.

    I am about to try this: http://www.codeproject.com/cs/miscctrl/listviewxp.asp


  • Sanchit Bahal

    you can set Opacity of the form as 0.99 in your design.cs

    Someone said that when the Opacity equals 1, the form is in one mode. When the Opacity less than 1, the form is in another mode. Maybe there's a gap between these two modes, so the form will have some flickers at the beginning of the fading.

    just have a try



  • Irritating Flicker Upon Startup