this is a sample code. let say I draw squares on a form
SolidBrush myBrush = new SolidBrush(Color.Red);
Graphics formGraphics = formnew.CreateGraphics();
formGraphics.FillRectangle(myBrush, new Rectangle(x1, y1, x2, y2));
now question is on a given instance of a form i can draw any no of squares.But how can i erace a just drawn rectangle(same as undo). I know i should use a memory stack and a array list but don't know how to implement it.
plese give a sample code.