I'm trying to create a smal paint component( similar to MSpaint but not the same thing) in vb.net.
I have a panel that holds the background image and a picturebox over the panel that I draw on. I'm using graphics to draw shapes and I have my own custom double buffer, meaning that I draw on the picturebox while the mouse ismoving and on mouse up I draw the final image on the buffer image and on paint event the buffer image replaces the picturebox image.
also, i have set the form properties to enable double buffering
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.UpdateStyles()
my problem is that no matter what i've tried the picture box keeps flickering. as long as the mouse is moving, the paint event keeps getting called and the image flickers like crazy
what i need is more ideas(or pseudocode) on how to avoid flickering.
thanks