Bad flicker effects in interactive mode

  • Thread starter Thread starter Sternchen
  • Start date Start date
S

Sternchen

Hi,
I wrote an application where you can create your own graph by adding
curve points into a coordinate system grid. The grid is placed on a
panel. Also you can pick the control points and drag them to another
spot. If I do so, I get such a bad flicker effect (only in the panel)
and sometimes the whole background is blank.

In my MouseMove method I do all the interactive stuff and update the
panel with panel.Invalidate().
Any idea?

Cheers
 
Thank you for your tip. Since I want to paint on the panel I use the
PaintEventArgs to create the graphics and it still flickers then. Do
you think that might be the reason?

I do following now:

private void PaintTF(object sender, PaintEventArgs e)
{

Graphics g = e.Graphics;

Graphics.FromImage(myBitmap).Clear(System.Drawing.Color.LightGray);
Graphics bufferedGraphics =
Graphics.FromImage(myBufferBitmap);
bufferedGraphics.DrawImage(myBitmap, 0, 0);

bufferedGraphics.DrawAllTheStuff....

g.DrawImage(myBufferBitmap, 0, 0);
bufferedGraphics.Dispose();
}


Cheers
 
Override the background paint method and comment out any UI added code.
Since you are painting the entire screen yourself, you don't need the
background paint.

Regards,
Rick D.
 
Back
Top