Hi
Firstly, avoid using TImageEnVect, it is a legacy component (and you make no use of the vect functionality in your demo).
Your code draws directly to the canvas. Direct editing of the bitmap does not trigger automatic saving of an undo, so you will need to manually save the undo first:
// Allow undo of an operation upon the bitmap canvas
ImageEnView1.Proc.SaveUndo( 'Draw Rectangle', ieuImage );
ImageEnView1.IEBitmap.Canvas.Pen.Color := clRed;
ImageEnView1.IEBitmap.Canvas.Rectangle( X1, Y1, X2, Y2 );
ImageEnView1.Update();
http://www.imageen.com/help/TImageEnProc.SaveUndo.html
Nigel
Xequte Software
www.imageen.com