Strange behaviour labels when using thread.sleep RRS feed

  • Question

  • Hi there, nothing too serious, but annoying all the same


    When showing a splash screen (or exit screen or just a user wait while computing or whatever) and keep the user waiting using thread.sleep(x) the labels on the form become transparent. I.e. you can see whatever's on the background through them, not what I've witten in them.


    I´ve tried hiding the main form, but then you´ll see the desktop instead.


    Just wondering whether this is a bug or am I doing something wrong? If you get rid of the thread.sleep there's no problem... (BTW VS c# 2005 express ed.)



    Monday, July 2, 2007 12:30 PM


  • If you do Thread.Sleep(), it interrupts all the painting for the form. This can result in all sorts of incorrectly drawn things.

    Rather than using Thread.Sleep(), you should set a Windows.Forms Timer to the delay period, and respond to the timer firing by closing the form.
    Monday, July 2, 2007 12:53 PM