Gets or sets a value indicating whether to throw an exception instead of returning a null reference on certain methods of this RasterCodecs object.
public bool ThrowExceptionsOnInvalidImages {get; set;}
Public Property ThrowExceptionsOnInvalidImages As Boolean
public bool ThrowExceptionsOnInvalidImages {get; set;}
public boolean getThrowExceptionsOnInvalidImages()
public void setThrowExceptionsOnInvalidImages(boolean value)
get_ThrowExceptionsOnInvalidImages();
set_ThrowExceptionsOnInvalidImages(value);
Object.defineProperty('ThrowExceptionsOnInvalidImages');
A value indicating whether to throw an exception instead of returning a null reference on certain methods of this RasterCodecs object.
Some of the methods of this RasterCodecs class will return an object when called. For example, the Load or LoadAsync methods will return the RasterImage object created. If the value of ThrowExceptionsOnInvalidImages is set to true, then when the Load, LoadAsync or LoadSvgAsync methods to return a null reference instead when it encounters an error and cannot return a valid image
The following methods will either throw an exception or return a null reference depending on the setting of the ThrowExceptionsOnInvalidImages property.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
using LeadtoolsExamples.Common;
public void ThrowExceptionsOnInvalidImagesExample()
{
RasterCodecs codecs = new RasterCodecs();
// enable codec exceptions
codecs.ThrowExceptionsOnInvalidImages = true;
try
{
RasterImage image = codecs.Load("some non-image file");
}
catch
{
Console.WriteLine("exception caught - sample sucess");
}
// Clean up
codecs.Dispose();
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Drawing
Imports Leadtools.Svg
Public Sub ThrowExceptionsOnInvalidImagesExample()
Dim codecs As RasterCodecs = New RasterCodecs()
' enable codec exceptions
codecs.ThrowExceptionsOnInvalidImages = True
Try
Dim image As RasterImage = codecs.Load("some non-image file")
Catch
Console.WriteLine("exception caught - sample sucess")
End Try
' Clean up
codecs.Dispose()
End Sub
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Examples;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Windows.Media;
public void ThrowExceptionsOnInvalidImagesExample(Stream inStream)
{
RasterCodecs codecs = new RasterCodecs();
// enable codec exceptions
codecs.ThrowExceptionsOnInvalidImages = true;
try
{
RasterImage image = codecs.Load(inStream); //some non-image file
}
catch
{
Debug.WriteLine("exception caught - sample sucess");
}
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Windows.Media
Public Sub ThrowExceptionsOnInvalidImagesExample(ByVal inStream As Stream)
Dim codecs As RasterCodecs = New RasterCodecs()
' enable codec exceptions
codecs.ThrowExceptionsOnInvalidImages = True
Try
Dim image As RasterImage = codecs.Load(inStream) 'some non-image file
Catch
Debug.WriteLine("exception caught - sample sucess")
End Try
End Sub
Products |
Support |
Feedback: ThrowExceptionsOnInvalidImages Property - Leadtools.Codecs |
Introduction |
Help Version 19.0.2017.6.16
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.