I have 2 Images, OriginalImage and TempImage.
I use this code to load Image in form:
this.DoubleBuffered = true;
Temp= new Bitmap(2, 2);
Original = new Bitmap(2, 2);
Original=Temp;
and change the Temp image(Rotate,Crop,etc)
When reset, I load the Original Image to load Elementary image in form but load the Temp image.
The issue is that
Bitmapis a class, and when you sayOriginal = Temp, you’re tellingOriginalto reference the sameBitmapinstance asTemp.The
Bitmapthat you instantiated forOriginalis lost and will be garbage collected, and if you dispose either one, both will stop working.What you’re looking for in that last line is
Bitmap.Clone(), so that you create a copy of Temp and store that in Original: