AnnLock example for Delphi
Note: |
This topic is for Document/Medical only. |
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;
//This example locks objects of type ANN_OBJECT_ELLIPSE using the key ‘LEADTOOLS‘.
procedure TForm1.Button2Click(Sender: TObject);
var
lType: TOleEnum;
a: Integer;
bSelected: Boolean;
nCount: Cardinal;
RasterVarObjects: LEADRasterVariant; //array for the selected object handles
begin
//lock only the ellipse objects that are selected
bSelected := False;
RasterAnn.AnnGetSelectCount ( ); //get number of selected objects
nCount:= RasterAnn.AnnPointCount;
RasterVarObjects:= CoLEADRasterVariant.Create ( );
RasterAnn.AnnGetSelectList ( RasterVarObjects ); //get the handles of the selected objects
for a := 0 to nCount-1 do
begin
RasterAnn.AnnGetType (RasterVarObjects.LongItemValue[a]);
lType:= RasterAnn.AnnType;
if (lType = ANN_OBJECT_ELLIPSE) then //Is the object an ellipse?
begin
bSelected := True;
RasterAnn.AnnLock (RasterVarObjects.LongItemValue[a], 'LEADTOOLS', False);
end;
end;
if (bSelected <> True) then
ShowMessage ('No Ellipse Objects were selected');
end;