Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement a blinking label on a form

I have a form that displays queue of messages and number this messages can be changed. Really I want to blink label (queue length) when the number of messages were increased to improve form usability. Should I implement custom control and use additional thread or timer to change color of label? Has anybody implemented so functionality? What is the best solution (less resources and less performance degradation) to implement so behaviour?

SOLUTION:

Form's component with timer that can restrict number of animations per second and implement fade out effect to external control background color.

like image 931
garik Avatar asked Feb 18 '11 14:02

garik


1 Answers

The following is blinking using async and await

private async void Blink(){
    while (true){
        await Task.Delay(500);
        label1.BackColor = label1.BackColor == Color.Red ? Color.Green : Color.Red;
    }
}
like image 67
IdontCareAboutReputationPoints Avatar answered Sep 28 '22 04:09

IdontCareAboutReputationPoints