I am unfamiliar with GDI+, but in general, there are two approaches that I can think of:
(I am assuming you want to have only one undo. I you want multiples, then you should do similar things, but use a collection/array to keep each change.
1) Keep a copy of the image before the last change (As was suggested by a previous post). This is expesive in RAM, expecially if you want to do multiple undos.
2) Determine a bounding box that is smaller than the entire image, but contains all of the pixels of the change. Keep this section of the image as was done in #1, with a definition of where is is located on the whole image.
3) If you can do layers (again I don't know GDI+ yet), make each change on it's own layer. You can even give the user access to each layer's transparency, to give them more control.
John R Lick
[email protected]