By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,462 Members | 3,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,462 IT Pros & Developers. It's quick & easy.

How to solve flicker effect

P: 4
Hi,

I read all threads to this topic which were exactly like my problem and I tried all solutions but it still doesnt want to work :(. Can anybody help?

I wrote an application where you can create your own graph by adding
curve points into a coordinate system grid. I create a Panel and draw everything on it.

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.

my paint method looks like this:

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();

}

And in the MouseMove method i do Panel.Refresh(). I also tried overriding the this.OnPaintBackground and this.OnPaint but then my graph gets drawn behind the panel but it is supposed to be on the panel. If anybody can help me with that, I would be so happy.

cheers
Feb 21 '08 #1
Share this Question
Share on Google+
1 Reply


P: 5
koi
Hai,

Rather than doing Panel.Refresh() do Panel.Invalidate().

Then make doublebuffer property of the application to true

hope it works..
Feb 26 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.