AnnToolChecked 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;
   RasterAnnToolbar.AnnParentRasterView := LEADRasterView1.Raster;
   LEADEventSink1.Connect (RasterAnn, _LEADRasterAnnotationEvents);
   RasterAnn.AnnUserMode:= ANN_USERMODE_DESIGN;
end;
procedure TForm1. LEADEventSink1Invoke(Sender: TObject; DispID: Integer;
  const IID: TGUID; LocaleID: Integer; Flags: Word; Params: tagDISPPARAMS;
  varResult, ExcepInfo, ArgErr: Pointer);
var
   iTool: OleVariant;
   TestString: String;
begin
   case (DispID) of
      LEADRASTERANNOTATIONEVENTS_ANNTOOLCHECKED: 
      begin
         iTool:= OleVariant (Params.rgvarg^[0]);
         Case iTool of
            ANN_TOOL_SELECT:
                 TestString:= 'Selection pointer tool';
            ANN_TOOL_LINE:
                 TestString:= 'Line tool';
            ANN_TOOL_RECT:
                 TestString:= 'Rectangle tool';
            ANN_TOOL_ELLIPSE:
                 TestString:= 'Ellipse tool';
            //...
            //...
            //...
            else
                 TestString:= 'User defined tool';
         end;

         ShowMessage (TestString);
      end;
   end;
end;