Danial
Danial

Reputation: 451

Blink Label without timer or delay

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

Upvotes: 0

Views: 1527

Answers (1)

Uwe Keim
Uwe Keim

Reputation: 40746

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).

Upvotes: 2

Related Questions