Rank: Member
Groups: Guest
Joined: 4/15/2007(UTC) Posts: 25
|
Ok ,Alex, but can i have PLEASE some help on how to do this? We have to make 2 changes to initial code. First change, we need to add 2 images for each thumbnail, instead of one, and second change we need to change the code on _SelectedIndexChanged event, so it shows the one with selection drawn over thumbnail. We use the code provided from the samples. This is how a thumbnail is created and loads a jpeg file: Code:'LOAD THUMBNAIL
Private Sub loadThumbnailJpeg(ByVal fileName As String)
filename="C:\test.jpg"
jpegReader = New JpegReader(fileName)
imageList.ImageSize = New Size(200, 200)
imageList.ColorDepth = ColorDepth.Depth24Bit
thumbnailsView.LargeImageList = imageList
For Each frame As JpegFrame In jpegReader
Dim thumbnailBitmap As New Aurigma.GraphicsMill.Bitmap
frame.GetThumbnail(thumbnailBitmap, 200, 200)
Dim thumbnail As Aurigma.GraphicsMill.Bitmap = CreateThumbnail(thumbnailBitmap)'<---CREATE THUMBNAIL
thumbnailsView.Items.Add("Page " & (number + 1).ToString(), number)
imageList.Images.Add(thumbnail.ToGdiplusBitmap())
number += 1
jpegReader.Close()
frame.Dispose()
thumbnail.Dispose()
Next
End Sub
'THUMBNAIL CREATION
Private Function CreateThumbnail(ByVal source As Aurigma.GraphicsMill.Bitmap) As Aurigma.GraphicsMill.Bitmap
'1.CREATION OF THE WHITE(EMPTY) BITMAP(THUMBNAIL)
Dim thumbnailBitmap As New Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.White, 200, 200, PixelFormat.Format24bppRgb)
'2.PUT THE IMAGE ONTO THE BITMAP(THUMBNAIL)
source.Draw(thumbnailBitmap, New Rectangle(CInt(CSng(thumbnailBitmap.Width - source.Width) / 2), _
CInt(CSng(thumbnailBitmap.Height - source.Height) / 2), source.Width, source.Height), _
CombineMode.Alpha, 1, InterpolationMode.LowQuality)
'3.CREATION OF THE BLACK PERIMETER ON THE THUMBNAIL
Dim graphics As GdiGraphics = thumbnailBitmap.GetGdiGraphics()
Dim pen As New Aurigma.GraphicsMill.Drawing.Pen(RgbColor.Black, 1)
graphics.DrawRectangle(pen, CInt((thumbnailBitmap.Width - source.Width) / 2), _
CInt((thumbnailBitmap.Height - source.Height) / 2), source.Width - 2, source.Height - 2)
graphics.Dispose()
Return thumbnailBitmap
End Function
'THIS IS HOW WE SHOW EACH THUMBNAIL, WHEN WE CLICK WITH MOUSE ON IT
Private Sub thumbnailsView_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles thumbnailsView.SelectedIndexChanged
Dim filename, extension As String
Dim selectedThumbnailIndex As Integer
Dim frame
If thumbnailsView.SelectedIndices.Count > 0 Then
selectedThumbnailIndex = thumbnailsView.SelectedIndices(0)
filename = "c:\TEST.JPG"
extension = IO.Path.GetExtension(filename)
If extension = ".jpg" Then
jpegReader = New JpegReader(filename)
frame = New JpegFrame
frame = CType(jpegReader.LoadFrame(0), JpegFrame)
End If
frame.GetBitmap(bitmapViewerMainView.Bitmap)
frame.Dispose()
End If
End Sub
Help on this would be VERY much appreciated, firamax Edited by user Monday, December 17, 2007 12:17:51 PM(UTC)
| Reason: Not specified
|