tags:

views:

34

answers:

2

hello!

I have a image drawn in an winform app and i designed a brush that moves after the cursor. The Brush is drawn every time so the image keeps flashing because the image is also redrawn . How can i avoid this ?

Regards, Alex Badescu

+3  A: 

Use double-buffering. Draw each frame to some kind of memory bitmap representing the back buffer and once it's drawn show it on the first.

For more info read here: http://msdn.microsoft.com/en-us/library/b367a457.aspx

Grozz
ah! Great Thanks!!
Badescu Alexandru
it kind of wasn't enough .. it still flickered . i introduced the following code
Badescu Alexandru
SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.UserPaint, true);
Badescu Alexandru
A: 

Simply set the form's DoubleBuffered property to true. That should solve the flickering.

No reason to make it more advanced than this, in such a simple scenario.

Øyvind Bråthen