The reason why the object is not merged is because MouseInteractVt is in miPutMemo and is still editing. To get around this problem set MouseInteractVt to nil or call ImageEnVect1.CancelInteracts then CopyObjectsToBack.
procedure Tfmain.Saveas1Click(Sender: TObject);
var
filename: string;
begin
filename := ImageEnVect1.IO.ExecuteSaveDialog();
if filename <> '' then
begin
// save the image without vectorial objects
ImageEnVect1.Proc.SaveUndo;
// exit editing mode by setting MouseInteractVt to nil or by calling CancelInteracts
ImageEnVect1.MouseInteractVt := []; // or
// ImageEnVect1.CancelInteracts;
// merge vectorial objects with the background image
ImageEnVect1.CopyObjectsToBack(true);
// save to disk
ImageEnVect1.IO.SaveToFile(filename);
// set MouseInteractVt back to miPutMemo
ImageEnVect1.MouseInteractVt := [miPutMemo];
// restore
ImageEnvect1.Proc.Undo;
end;
end;
There may be other ways to do this, but you have to exit memo editing mode before merging the objects to the background.
William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html