public RasterCommandProgressEventArgs(int percent)
(id)initWithPercent:(int)percent; public RasterCommandProgressEvent(Object source,int percent)
public:RasterCommandProgressEventArgs(int percent)
__init__(self,percent) # Overloaded constructor
percent
The percentage completion of the command.
The value of Cancel is initialized to false by default.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;public void RasterCommandExample(){RasterCodecs codecs = new RasterCodecs();string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");string rotatedFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1_rotated.bmp");string flippedFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1_flipped.bmp");// Load the source image from diskRasterImage image = codecs.Load(srcFileName);// flip the imageFlipCommand flip = new FlipCommand(false);RunCommand(image, flip);// save the imagecodecs.Save(image, flippedFileName, RasterImageFormat.Bmp, 24);// rotate the image by 45 degreesRotateCommand rotate = new RotateCommand();rotate.Angle = 45 * 100;rotate.FillColor = RasterColor.FromKnownColor(RasterKnownColor.White);rotate.Flags = RotateCommandFlags.Resize;RunCommand(image, rotate);// save the imagecodecs.Save(image, rotatedFileName, RasterImageFormat.Bmp, 24);// clean upimage.Dispose();codecs.Dispose();}bool cancelAt50;void RunCommand(RasterImage image, RasterCommand command){// subscribe to the progress event of the commandcommand.Progress += new EventHandler<RasterCommandProgressEventArgs>(command_Progress);// if this is a flip command, we want to stop at 50 percentcancelAt50 = command is FlipCommand;// run the commandcommand.Run(image);command.Progress -= new EventHandler<RasterCommandProgressEventArgs>(command_Progress);}void command_Progress(object sender, RasterCommandProgressEventArgs e){// show the percentageConsole.WriteLine(e.Percent);// check if we need to cancel the command at 50%if (e.Percent == 50 && cancelAt50)e.Cancel = true;}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
