Visual Basic (Declaration) | |
---|---|
Public Property ThrowExceptionsOnInvalidImages As Boolean |
Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As RasterCodecs Dim value As Boolean instance.ThrowExceptionsOnInvalidImages = value value = instance.ThrowExceptionsOnInvalidImages |
C# | |
---|---|
public bool ThrowExceptionsOnInvalidImages {get; set;} |
C++/CLI | |
---|---|
public: property bool ThrowExceptionsOnInvalidImages { bool get(); void set ( bool value); } |
Property Value
A value indicating whether to throw an exception instead of returning a null reference (Nothing in Visual Basic) on certain methods of this RasterCodecs object.
Visual Basic | Copy Code |
---|---|
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 |
C# | Copy Code |
---|---|
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(); } |
SilverlightCSharp | Copy Code |
---|---|
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"); } } |
SilverlightVB | Copy Code |
---|---|
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 |
Some of the methods of this RasterCodecs class will return an object when called. For example, the RasterCodecs.Load or RasterCodecs.LoadAsync methods will return the Leadtools.RasterImage object created. If the value of ThrowExceptionsOnInvalidImages is set to true, then when the RasterCodecs.Load or RasterCodecs.LoadAsync methods encounters an error and cannot return a valud image, it will throw an appropriate exception.
Set ThrowExceptionsOnInvalidImages to false to cause the RasterCodecs.Load or RasterCodecs.LoadAsync methods to return a null reference (Nothing in Visual Basic) instead when it encounters an error and cannot return a valud image
The following methods will either throw an exception or return a null reference (Nothing in Visual Basic) depending on the setting of the ThrowExceptionsOnInvalidImages property.
- GetInformation(String,Boolean)
- RasterCodecs.GetInformationAsync
- RasterCodecs.Load
- RasterCodecs.LoadAsync
- ReadMarkers(String)
- ReadThumbnail(String,CodecsThumbnailOptions,Int32)
- ReadStamp(String,Int32)
- ReadTag(String,Int32,Int32)
- ReadGeoKey(String,Int32,Int32)
- ReadComment(String,Int32,RasterCommentMetadataType)
- ReadExtensions(String,Int32)
Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)