AnnAutomation Property 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;
//This example shows how you can use the AnnAutomation property
//to access the automation object through API functions.
procedure TForm1.Button2Click(Sender: TObject);
var
nRet: Integer;
IsBold: Longint; //Is the object's text bold
hAnnObject: Longint;
begin
hAnnObject:= RasterAnn.AnnAutomation;
//Toggle the default font bold property
L_AnnGetFontBold (hAnnObject, @IsBold);
if (IsBold <> 0) then
ShowMessage ('Removing bold')
else
ShowMessage ('Making bold');
nRet:= L_AnnSetFontBold (hAnnObject, Not IsBold, 0);
if (nRet <> SUCCESS) then
ShowMessage ('L_AnnSetFontBold failed: ' + IntToStr(nRet));
end;