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.
The following is blinking using
async
andawait
Here is a pretty simple implementation that would work inside your form. You could also create a custom control with the same code and just throw the
Timer.Start()
into a method for that control.You can use
Timer
class here. Here what I have implemented. Label color blinking on Button_click Event.You can create custom component and events for start blinking. I think is good solution. Blinking you can implement with timer.
Create your own
UserControl
for this, one that inherits fromLabel
instead of fromControl
directly. Add aStartBlinking
method, in which you start aTimer
object whose tick event alters the style of the label (changing the BackgroundColor and ForegroundColor properties each time to create the blink effect).You could also add a
StopBlinking
method to turn it off, or you could have yourTimer
stop itself after 5 seconds, perhaps.I know this is a really old post, but anyone looking for something a little more versatile than the Boolean solutions posted may get some use out of the following:
Which you can call like such: