C # WinForms shortcut will display but not show text

I am developing a GUI and I have a shortcut that I use effectively as a "please wait" message after I invoke an action that tends to take some time. The label text is static, I set it in VS2010 properties to control the label.

When I hit this action on the form, I have a .Show () control, which is usually hidden until the long process is complete, then .Hide (). When it gets into .Show (), a shortcut appears (I know this because I have BorderStyle set to Fixed3D, so I see that the border of the label is displayed), but there is no text in it. I tried to set the shortcut to automation, and not to no, my text is set to black on gray, so no invisible ink, everything is visible, the font is installed. The code runs the way I want it all over, theres just no text in the shortcut. I'm at a loss.

Any ideas?

+6
source share
3 answers

If the time process takes the same thread, then this may be an update / redraw problem (when the processor is too busy to process user interface requests). Try either updating the window before starting a lengthy process, or, in a more appropriate way, putting the process a lot of time in BackgroundWorker.

+10
source

If the time-consuming process is not running in the background thread, your user interface is not updated because message processing does not occur. Controls are redrawn in WM_Paint messages.

Try calling Refresh on the control or on its parent window element (form) after changing its state before plunging into a lengthy process.

Or move a lengthy process to a background thread (see the .NET 4.0 task) to free up the user interface thread.

+6
source

Maybe something is missing for me, but why don't you just set label.Visible ?

+3
source

All Articles