How to avoid flickering problem when drawing?`
-
Hi, guys, I am now developing a drawing program in C#. Everytime when adding new lines, ellipse or other shapes, I have to use "this.Invalidate(); this.Update();" to refresh the drawing area then new shapes will appear. However, it has to paint all the shapes I drew before, or the shapes I drew before may be erased! But everytime redrawing every shape causes terribly flicking! How to avoid this? Can it only draw newly-drawn shape? ps: I use ControlStyles.DoubleBuffer and ControlStyles.UserPaint. The effect is not obvious. Many thanks! Radic Beijing, China -- modified at 21:25 Sunday 28th August, 2005
-
Hi, guys, I am now developing a drawing program in C#. Everytime when adding new lines, ellipse or other shapes, I have to use "this.Invalidate(); this.Update();" to refresh the drawing area then new shapes will appear. However, it has to paint all the shapes I drew before, or the shapes I drew before may be erased! But everytime redrawing every shape causes terribly flicking! How to avoid this? Can it only draw newly-drawn shape? ps: I use ControlStyles.DoubleBuffer and ControlStyles.UserPaint. The effect is not obvious. Many thanks! Radic Beijing, China -- modified at 21:25 Sunday 28th August, 2005
You need to look into double buffering. You can actually set up C# to do this for you, just google double buffer C# and you're sure to find plenty of info. Christian Graus - Microsoft MVP - C++
-
You need to look into double buffering. You can actually set up C# to do this for you, just google double buffer C# and you're sure to find plenty of info. Christian Graus - Microsoft MVP - C++
Thanks, Christian! Absolutely you are the most warm-hearted!