What is the best practise for viewing & modifying images in a Vintasoft ImageViewer component?
Do I need to keep the stream to the image open or close it?
In the documentation I found following code:
Code: Select all
Dim images As ImageCollection = New ImageCollection()
Dim fStream As FileStream = New FileStream("multipage.tif", FileMode.Open, FileAccess.ReadWrite)
Dim images As ImageCollection images = New ImageCollection
images.Add(fStream)
As I use a lot of ImageViewer components in my application gui, I need to keep a lot of streams open, which I don't like!
Code: Select all
at System.IO.__Error.FileNotOpen()
at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin)
at System.IO.FileStream.set_Position(Int64 value)
at Vintasoft.Imaging.Codecs.ImageFileSource.set_Position(Int64 value)
at Vintasoft.Imaging.Codecs.Tiff.TiffTag.()
at ..()
at ..()
at Vintasoft.Imaging.Codecs.Tiff.TiffPage.GetStripGrid()
at Vintasoft.Imaging.Codecs.TiffDecoder.GetImageRectGrid(Int32 pageIndex)
at Vintasoft.Imaging.ImageRendering.ImageRenderer..ctor(DecoderBase decoder, Int32 pageIndex)
at Vintasoft.Imaging.ImageRendering.ImageRenderer..ctor(VintasoftImage image)
at ..6(VintasoftImage )
at Vintasoft.Imaging.ImageViewer.(VintasoftImage , Boolean )
at Vintasoft.Imaging.ImageViewer.(VintasoftImage , Boolean )
at ..81()
at ..()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()