I have a simple panel that is used as a drawing surface. The goal here is to draw a 4 pixel wide outline around a child ListView under certain circumstances. I would like to make the outline pulsate when something can be dragged into it.
I am just drawing a simple rectangle around the ListView and updating the opacity of the rectangle inside of a timer tick event. When the opacity is changed, the border is re-drawn. I am double-buffering the painting at this point. I am also only allowing a redraw every 15 ticks or so (the timer interval is 20 ms). After all of this, the drawing process still flickers a bit. This is not acceptable, so I need some guidance on how I could avoid this.
I don't see a way around painting the control quite often. There needs to be a smooth transition from opaque to solid and back again. When I lower the tick interval enough (down to about 300 -500 ms), the flashing stops, but the refresh rate is too slow.
I am open to any and all ideas. Perhaps the way I am approaching this is just plain wrong, or perhaps one of you have already created a glow effect and know what to do. Thanks for any help in advance.