MessageBox clears my splash screen

  • Thread starter Henrik Skak Pedersen
  • Start date
H

Henrik Skak Pedersen

Hello,

I am opening a messagebox on top of a splash screen. The splash screen is a
normal windows form with(FormBorderStyle=None, StartPosition=Center and
TopMost=true).

My problem is that my MessageBox is clearing the splash form behind it. When
I press OK on the message box, the splash form is all gray(the background
color) and no controls are visible. I have tried to set up a timer on the
splash screen, and when the timer kicks in, the form is visible and it does
not help to call neither Update og invalidate on the form. The only thing
that helps is if I call Hide() and Show(), then all my controls are visible.

I call the messagebox with the owner window, but there is no difference.

Any ideas?

Thanks

Henrik.
 
O

Oliver Sturm

Henrik said:
I am opening a messagebox on top of a splash screen. The splash screen is
a normal windows form with(FormBorderStyle=None, StartPosition=Center and
TopMost=true).

My problem is that my MessageBox is clearing the splash form behind it.
When I press OK on the message box, the splash form is all gray(the
background color) and no controls are visible. I have tried to set up a
timer on the splash screen, and when the timer kicks in, the form is
visible and it does not help to call neither Update og invalidate on the
form. The only thing that helps is if I call Hide() and Show(), then all
my controls are visible.

I call the messagebox with the owner window, but there is no difference.

My guess is that you are hogging the UI thread, so the splash window is
never redrawn after it's been invalidated by the message box. Are you
showing the splash window on a separate thread? Or do you use a separate
thread for the other initialization work that's going on? If you show the
splash window on the same thread where you're doing other work, no redraw
can take place after the window has been shown initially.

The way I do this is to run an additional GUI thread for the splash
window. The advantage (compared to the more common approach of doing
initialization on an extra thread) is that the main application GUI thread
can be used to do initialization, so you can actually create forms and
controls and everything while still showing a nice fluent status animation
in the splash window.


Oliver Sturm
 
H

Henrik Skak Pedersen

Hi Oliver,

Thank you very much for your reply. That solved my problem.

Cheers

Henrik.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top