I have written a tetris game in C#.I'm drawing the shapes in picturebox by using below code.
graphics g
g = pictureBox1.CreateGraphics();
I'm drawing the next step of the shapes by cleaning every second with through timer code. My question is:it's working slowly picturebox.refresh() command and distorted display.What should I do?
I tried below function.But,it's not working.I have same problem.
public void EnableDoubleBuffering()
{
// Set the value of the double-buffering style bits to true.
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
}