I'm creating a drawing program of sorts, and I'm trying to implement undo and redo. Rather than go through the pain of saving everything ever drawn as a trackable object, I'd like to figure out how to grab what the form looks like before something is drawn, save that, and then save what it looks like after the user is done with a mouse stroke.
1. The blank canvas is added to the undo stack.
2. User draws.
3. Left mouse button lifts
4. Current state of canvas is added to the undo stack.
5. User presses 'U'
6. The stack is popped, and the form's content is changed to the image saved.
The logic itself makes sense, and should work, but I'm having trouble locating the correct way to capture the content itself. I tried backgroundImage, but that seems to not be affected by what a Graphics object draws on it. Does anyone have any tips or ideas?