EnableMethodErrors example for Delphi
This example disables method errors temporarily so that it can give the user guidance about a particular error (an out-of-range shear angle using ILEADRasterProcess in this case).
var
//Declare local variables.
ShearAngle, nRet: Integer;
cMsg: String;
RasterProc: LEADRasterProcess;
sRet: smallint;
begin
RasterProc:= CreateComObject (CLASS_LEADRasterProcess) as LEADRasterProcess;
ShearAngle:= 9000 ;// This would be the user's input * 100
RasterProc.EnableMethodErrors := False;
nRet:= RasterProc.Shear (LEADRasterView1.Raster, ShearAngle, True, RGB(0, 0, 255));
if (nRet = 20013) then
begin
cMsg:= 'The angle cannot be more than 45 degrees';
MessageBox ( Handle, PChar(cMsg), 'Error', MB_OK );
end
else
begin
if (nRet = 0) then
LEADRasterView1.ForceRepaint ( sRet )
else
ShowMessage ( 'Error: ' + IntToStr (nRet)) ;
end;
end;