If what you are trying to do is to draw the modified table at both its original location and current mouse location, you could implement it via DrawForeground event handler:
RectangleF originalPos = RectangleF.Empty;
DiagramNode modifiedNode = null;
void OnNodeStartModifying(object sender, NodeValidationEventArgs e)
{
originalPos = e.Node.Bounds;
modifiedNode = e.Node;
}
void OnDrawForeground(object sender, DiagramEventArgs e)
{
if (modifiedNode != null)
{
var state = e.Graphics.Save();
e.Graphics.TranslateTransform(
originalPos.X - modifiedNode.Bounds.X,
originalPos.Y - modifiedNode.Bounds.Y);
modifiedNode.Draw(e.Graphics, new RenderOptions());
modifiedNode.DrawHandles(e.Graphics, diagram.ActiveItemHandlesStyle);
e.Graphics.Restore(state);
}
}
void OnNodeModified(object sender, NodeEventArgs e)
{
modifiedNode = null;
diagram.Invalidate();
}
That will also save you some headaches with undo/redo.
If you prefer the custom behavior solution and using a second table, where the original remains selected, first you will have to remove the code that changes the selection:
//base.Diagram.Selection.Clear();
//item.Selected = true;
//base.Diagram.ActiveItem = item;
and start modification via the item variable instead of ActiveItem:
//return new InteractionState(activeItem, handle, Action.Modify);
return new InteractionState(item, handle, Action.Modify);
You will also have to temporarily change the HandlesStyle to Invisible or InvisibleMove, since handles for the currently modified item are always drawn:
item.HandlesStyle = HandlesStyle.InvisibleMove;
I hope that helps,
Stoyan