2

I draw a rectangle on the image which is in PictureBoxcontrol.

For drawing I use this function:

Rectangle rect = contourDetected.BoundingRectangle;

Bitmap bmpOriginalImage = new Bitmap(pbxOriginalImage.Image);
img.Draw(rect, new Bgr(Color.Aquamarine), 2);

pbxOriginalImage.Image = img.ToBitmap();

Is there any function that erase last drawn curve?

Michael
  • 13,950
  • 57
  • 145
  • 288

1 Answers1

4

There's no such function. The Bitmap doesn't keep track of how it got to be in a particular state. It just keeps track of the pixel buffer.

You'll have to write your own facility to undo drawing. Remember the previous version of the bitmap, and if you need to go back, just restore that previous version.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490