Is it possible to make label blink without using any of these? as i have a backgroundworker and want it to give alarm to the client while doing its work
Asked
Active
Viewed 1,472 times
0
-
3What would make it come on and off, if not a timer? Why do you not want to use a timer? – Oded Oct 14 '11 at 16:41
-
2You could use an animated gif instead of a label. http://stackoverflow.com/questions/165735/how-do-you-show-animated-gifs-on-a-windows-form-c – David Oct 14 '11 at 16:43
1 Answers
2
You could use the BackgroundWorker.ReportProgress
method to notify your foreground thread every now and then.
Subscribe to the Backgroundworker.ProgressChanged
event and do your "animation", i.e. changing the colors or visibility, similar to what @HasanKhan suggests in the comment below:
MyLabel.Visible = progress % 2==0 ? true : false;
(Please note that the ProgressChanged
event is already being executed in the foreground thread so there is no need to call Control.Invoke
).

Uwe Keim
- 39,551
- 56
- 175
- 291
-
1In Progress Changed Event set Visible = progress % 2==0 ? Visible : Hidden; – Muhammad Hasan Khan Oct 14 '11 at 16:43