AnnRotate example for Delphi
Note: |
This topic is for Document/Medical only. |
//This example uses the AnnFlip, AnnReverse, and AnnRotate methods. To code this //example, add a button named Test to the example you created in Loading and //Displaying an Image. For best results when you run the example, draw two objects in //opposite corners, and use the right mouse button to select all annotation objects. The
// button then lets you cycle through the AnnFlip, AnnReverse, and AnnRotate
//methods.
var
//Global declarations
RasterAnn: LEADRasterAnnotation;
procedure TForm1.Button1Click(Sender: TObject);
begin
RasterAnn:= CoLEADRasterAnnotation.Create ();
RasterAnn.AnnParentRasterView := LEADRasterView1.Raster;
LEADEventSink1.Connect (RasterAnn, _LEADRasterAnnotationEvents);
RasterAnn.AnnUserMode:= ANN_USERMODE_DESIGN;
end;
procedure TForm1.AnnRotateClick(Sender: TObject);
var
MyCaption: String;
begin
MyCaption := AnnRotate.Caption;
if (MyCaption= 'Flip') then
begin
//Flip using the center of the bitmap as the axis.
RasterAnn.AnnFlip (True, LEADRasterView1.Raster.BitmapHeight / 2, True);
AnnRotate.Caption := 'Reverse';
end
else
begin
if (MyCaption= 'Reverse')then
begin
//Reverse using the center of the bitmap as the axis.
RasterAnn.AnnReverse (True, LEADRasterView1.Raster.BitmapWidth / 2, True);
AnnRotate.Caption := 'Rotate';
end
else
begin
if (MyCaption= 'Rotate')then
begin
//Rotate 90 degrees using the center of the bitmap as the axis.
RasterAnn.AnnRotate (True, LEADRasterView1.Raster.BitmapWidth / 2, LEADRasterView1.Raster.BitmapHeight / 2, 90, True);
AnnRotate.Caption := 'Flip';
end
else
begin
AnnRotate.Caption := 'Flip';
RasterAnn.AnnUserMode := ANN_USERMODE_DESIGN;
RasterAnn.AnnTool := ANN_TOOL_REDACT;
ShowMessage ('Draw two objects, use the right mouse button to select all, then click the command button');
end;
end
end;
end;