Occurs during the file load process to provide functionality for manually handling the output image data or monitoring a
progress status.
Syntax
Example
Visual Basic | Copy Code |
---|
RasterCodecs.LoadImage
Private Sub Codecs_LoadImage(ByVal sender As Object, ByVal e As CodecsLoadImageEventArgs)
e.Cancel = True
If e.Buffer <> IntPtr.Zero Then
Console.WriteLine("File name is: {0}", e.FileName)
Console.WriteLine("The Image width and height is: {0},{1}", e.Image.Width, e.Image.Height)
Console.WriteLine("The Length of the buffer is: {0}", e.Length)
Console.WriteLine("The current row in the first line of the buffer is: {0}", e.Row)
If e.OffsetValid Then
Console.WriteLine("Offset count is : {0}", e.OffsetCount)
Console.WriteLine("Offset value is : {0}", e.Offset)
End If
If e.TileValid Then
Dim rect As Rectangle = e.Tile
Console.WriteLine("Tile Dimension ({0},{1},{2},{3)}", rect.X, rect.Y, rect.Width, rect.Height)
End If
Console.WriteLine("Page Index is: {0}", e.Page)
Console.WriteLine("Page Count is: {0}", e.PageCount)
Console.WriteLine("Image Page Index is: {0}", e.ImagePage)
Console.WriteLine("Flags = {0}", e.Flags)
Dim loadStream As System.IO.Stream = e.Stream
Dim info As CodecsImageInfo = e.Info
e.Cancel = False
End If
End Sub
Public Sub LoadImageExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
AddHandler codecs.LoadImage, AddressOf Codecs_LoadImage
Dim image As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1.cmp")
RemoveHandler codecs.LoadImage, AddressOf Codecs_LoadImage
codecs.Dispose()
image.Dispose()
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
RasterCodecs.LoadImage private void Codecs_LoadImage(object sender, CodecsLoadImageEventArgs e) { e.Cancel = true; if(e.Buffer != IntPtr.Zero) { // get all properties for the CodecsLoadImageEventArgs class. Console.WriteLine("File name is: {0}", e.FileName); Console.WriteLine("The Image width and height is: {0},{1}", e.Image.Width, e.Image.Height); Console.WriteLine("The Length of the buffer is: {0}", e.Length); Console.WriteLine("The current row in the first line of the buffer is: {0}", e.Row); if(e.OffsetValid) { Console.WriteLine("Offset count is : {0}", e.OffsetCount); Console.WriteLine("Offset value is : {0}", e.Offset); } if(e.TileValid) { Rectangle rect = e.Tile; Console.WriteLine("Tile Dimension ({0},{1},{2},{3)}", rect.X, rect.Y, rect.Width, rect.Height); } Console.WriteLine("Page Index is: {0}", e.Page); Console.WriteLine("Page Count is: {0}", e.PageCount); Console.WriteLine("Image Page Index is: {0}", e.ImagePage); Console.WriteLine("Flags = {0}", e.Flags); System.IO.Stream loadStream = e.Stream; CodecsImageInfo info = e.Info; e.Cancel = false; } } public void LoadImageExample() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); codecs.LoadImage += new EventHandler<CodecsLoadImageEventArgs>(Codecs_LoadImage); RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1.cmp"); codecs.LoadImage -= new EventHandler<CodecsLoadImageEventArgs>(Codecs_LoadImage); // Clean up codecs.Dispose(); image.Dispose(); RasterCodecs.Shutdown(); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also