Bad flicker effects in interactive mode

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
 
S

Sternchen

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
 
D

dbgrick

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top