c# - How can I undo changes and retrieve previous form state in winform? -


i programming game, in need undo steps, there direct way this? tried putting controls in data structures, stacks , lists , so, things complicated in game. thanks

no, there not built-in way this; have code yourself. suggest creating class formstate has members represent values of each control on form state want save. add methods copy form values , form. finally, make stack data structure in program. whenever user changes on form, create new instance of formstate, call method transfer current form state formstate object, , push on stack. if user presses undo, pop last state off stack , call method restore form controls formstate class. that's there it.


Comments