I wrote a scrolling text marquee that renders text into a memory buffer (a System.Drawing.Bitmap) and uses a timer to update the scrolling text by rendering the buffer with Graphics.DrawImage.
I have tried everything and no matter what I always get flickers.
I enabled double buffering:
this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
The Graphics object is created from a panel, which is used as canvas.
_oGraphics = oDest.CreateGraphics(); // oDest is a System.Windows.Forms.Panel
I created a memory buffer for the background and
// render the buffer
_oGraphics.DrawImage(_oImageBackground, 0, 0);
// Render canvas
if(_oCanvas != null)
_oGraphics.DrawImage(_oCanvas.Canvas, _iCursor, 0);
Clearing the Graphics object is worse. I'm at loss...
Refresh is based on a timer at a 30 millisecond interval and _iCursor moves 2 pixels at a time. Display is otherwise smooth.