How to solve flicker effect

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sternchen
    New Member
    • Oct 2007
    • 4

    How to solve flicker effect

    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.FromIm age(myBitmap).C lear(System.Dra wing.Color.Ligh tGray);
    Graphics bufferedGraphic s = Graphics.FromIm age(myBufferBit map);
    bufferedGraphic s.DrawImage(myB itmap, 0, 0);

    bufferedGraphic s.DrawAllTheStu ff....

    g.DrawImage(myB ufferBitmap, 0, 0);
    bufferedGraphic s.Dispose();

    }

    And in the MouseMove method i do Panel.Refresh() . I also tried overriding the this.OnPaintBac kground 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
  • koi
    New Member
    • Feb 2008
    • 5

    #2
    Hai,

    Rather than doing Panel.Refresh() do Panel.Invalidat e().

    Then make doublebuffer property of the application to true

    hope it works..

    Comment

    Working...