0

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

vcsjones
  • 138,677
  • 31
  • 291
  • 286
Danial
  • 451
  • 6
  • 17
  • 3
    What 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
  • 2
    You 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 Answers1

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