I have a splash screen on my application, it is a windows form with no border. I create it as the app starts, during the creation of my main form.
The screen shows, but the labels with my company name and other details do not paint. They are show as blank space on the form.
The code is simple, my "Program" class, creates the main form. The main form has the splash screen created in it's member vars. In the ctor, I call _splash.Show(). Then later (In the main form's Load handler) I hide it and dispose it. I even added a _splash.Invalidate(true) after the show, but my labels and pictures are not painted (the appear as control grey blank spaces).
Is there a way to force these labels to show?
Thanks,
Bob
Hi Bob,
The question isn't how to force the labels to show, the question is why aren't they showing in the first place. I'm afraid I can't think of any reason why the labels simply wouldn't show up. This must be causing by something your application is doing. But I don't really have a guess as to what that might be and there's no information here to go on.
Can you duplicate this in a small sample project?
Hey Mike,
This is a rough sample. I have a few buttons on the form. Ignore all but Button2.
Click on Button2, and it will launch a "Splash" screen. Then it will loop for a few minutes, then hide the form.
Notice that you can see through two label areas on the form.
So you are calling Show on the form and then your code here goes into a tight loop before the labels have had a chance to paint.
I was able to get around this by calling f.Refresh() right after f.Show().
If you need these labels to update their display while the loop it occurring, then you will have to have some way for them to be responsive. You could call Refresh on the form or on the labels whenever their text changes, for example.
Thanks Mike,
I was calling Invalidate instead of Refresh.
I think Invalidate just marks the area of the screen dirty so that it will update itself the next time it gets a Paint message.
Refresh actually forces a paint.