AnnEnumerate example for Delphi
var
//Global declarations
RasterAnn: LEADRasterAnnotation;
RasterAnnToolbar: LEADRasterAnnToolBar;
procedure TForm1.Button1Click(Sender: TObject);
begin
RasterAnn:= CoLEADRasterAnnotation.Create ();
RasterAnnToolbar:= CoLEADRasterAnnToolBar.Create ();
RasterAnn.AnnParentRasterView := LEADRasterView1.Raster;
LEADEventSink1.Connect (RasterAnn, _LEADRasterAnnotationEvents);
RasterAnn.AnnUserMode:= ANN_USERMODE_DESIGN;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
//This example causes the AnnEnumerate event to get fired for all annotations in the container.
RasterAnn.AnnEnumerate (RasterAnn.AnnContainer, ANN_FLAG_RECURSE + ANN_FLAG_NOTTHIS, '');
end;
procedure TForm1. LEADEventSink1Invoke(Sender: TObject; DispID: Integer;
const IID: TGUID; LocaleID: Integer; Flags: Word; Params: tagDISPPARAMS;
varResult, ExcepInfo, ArgErr: Pointer);
var
hAnnObject: OleVariant;
begin
case (DispID) of
LEADRASTERANNOTATIONEVENTS_ANNENUMERATE:
begin
hAnnObject:= OleVariant(Params.rgvarg^[0]);
ShowMessage ('Annotation Handle: ' + IntToHex(hAnnObject, 6));
end;
end;
end;