Dim selectedImage As VintasoftImage() = Nothing
Dim selectedIndices As Integer() = .thumbnailViewer1.SelectedIndices.ToArray()
If _myCollection.Count > 0 Then
selectedImage = New VintasoftImage(selectedIndices.Length - 1) {}
For i As Integer = 0 To _myCollection.Count - 1
selectedImage(i) = .thumbnailViewer1.Images(_myCollection(i))
Dim image As VintasoftImage = selectedImage(i)
image.Dispose() ' problem is here
Next
End If
How do I write back those remaining pages to the source file?
A code sample would greatly be appreciated!
Here is example that shows how to delete selected thumbnails in thumbnail viewer and save image in thumbnail viewer to a file. As filename can be used the name of new file or source file.
Private Sub RemoveSelecedImagesAndSave(thumbnailViewer As ThumbnailViewer, filename As String)
Dim indexes As Integer() = thumbnailViewer.SelectedIndices.ToArray()
Dim removingImages As New List(Of VintasoftImage)
For Each index As Integer In indexes
removingImages.Add(thumbnailViewer.Images(index))
Next
thumbnailViewer.Images.RemoveRange(indexes)
For Each image As VintasoftImage In removingImages
image.Dispose()
Next
Dim encoder As EncoderBase = AvailableEncoders.CreateEncoder(filename)
encoder.SaveAndSwitchSource = True
thumbnailViewer.Images.SaveSync(filename, encoder)
End Sub