in my project about image processing I need to have Undo/Redo button. Briefly saying I do multiple operations on Bitmaps which then I assign to picturebox. I found this article http://www.codeproject.com/Articles/10576/An-Undo-Redo-Buffer-Framework I created my Originator based on the one from example code.
It looks like that
class Originator : ISupportMemento
{
private Bitmap state;
public IMemento Memento
{
get
{
Memento mcm = new Memento();
mcm.State = GetMyState();
return mcm;
}
set
{
SetMyState(value.State);
}
}
protected object GetMyState()
{
return state;
}
protected void SetMyState(object newstate)
{
state = (Bitmap)newstate;
}
}
But when i am trying to assing a bitmap object to it, Compilator is messaging an error.
UndoBuffer bufferr = new UndoBuffer();
Originator orig;
orig.Memento = (object)_baseimg;
Could you please help me, very sorry for my bad english.