Where are you caling this?
Try this:
Open the ...Annotations\Vectorial Demo in the samples folder.
Add a button to the properties scrollbox located on the right side of the main form. Add a ImageEnView to Panel2 located on the left side of the main form. Set the AutoShrink property of the ImageEnView2 to true (ImageEnView2.AutoShrink := True). Then add the following code:
procedure TMainForm.LoadLayers1Click(Sender: TObject);
var
iMS: TMemoryStream;
iLayer: integer;
begin
if OpenImageEnDialog1.Execute then
begin
ImageEnVect1.IO.LoadFromFile(OpenImageEnDialog1.FileName);
ImageEnVect1.LayersSync := False;
ImageEnVect1.CurrentLayer.VisibleBox := True;
ImageEnVect1.CurrentLayer.Selectable := True;
ImageEnVect1.LayersDrawBox := True;
end;
iLayer := ImageEnVect1.LayersAdd;
if OpenImageEnDialog1.Execute then
ImageEnVect1.IO.LoadFromFile(OpenImageEnDialog1.FileName);
iMS := TMemoryStream.Create;
try
ImageEnVect1.LayersSaveToStream(iMS);
iMS.Position := 0;
ImageEnView2.LayersLoadFromStream(iMS);
ImageEnView2.Update;
finally
iMS.Free;
end;
ImageEnVect1.LayersCurrent := iLayer;
ImageEnVect1.MouseInteract := [miMoveLayers, miResizeLayers];
end;
procedure TMainForm.ImageEnVect1LayerNotify(Sender: TObject; layer: Integer; event: TIELayerEvent);
var
iMS: TMemoryStream;
begin
// If moving or resizing a layer update the preview ImageEnView
if (event = ielMoving) or (event = ielResized) then
begin
iMS := TMemoryStream.Create;
try
ImageEnVect1.LayersSaveToStream(iMS);
iMS.Position := 0;
ImageEnView2.LayersLoadFromStream(iMS);
ImageEnView2.Update;
finally
iMS.Free;
end;
end;
end;
Click the button then select a layer with the mouse and move it around. All the layers should appear in the ImageEnView (preview) and the layers should be updated when you move the layer in ImageEnVect.
This works with no exceptions or errors here. I have no idea why you get an exception.
William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html