InsertThumbs Example VB

This example demonstrates how the Thumbnail control can be updated when images are dropped onto it. A message box is displayed detailing the source file and pages as well as the insertion thumbnail for each thumbnail droppped onto the control. The source can be a drop from Explorer, Imaging for Windows, or selected thumbnails from another Thumbnail control.

For this example, the EnableDragDrop property has been set to DropFileDropDragLeftRight. The property must have been set prior to performing any drag or drop operation.

Private Sub ImgThumbnail1_ThumbDrop(ByVal InsertBefore As Long, ByVal DropCount As Long, ByVal Shift As Integer) 
    Dim DropMsg As String
    On Error GoTo DropError
    'Loop to process each thumb being dropped; index starts at 0
    For InsertCount = 0 To DropCount - 1
        srcFile = ImgThumbnail1.ThumbDropNames(InsertCount)
        srcPage = ImgThumbnail1.ThumbDropPages(InsertCount)        
        'Insert page into image file first, then Thumbnail control
        ImgAdmin1.Insert srcFile, srcPage, InsertBefore, 1 
       'Image file saved after insert
        ImgThumbnail1.InsertThumbs InsertBefore, 1
        'Provide information regarding dropped page
        DropMsg = "Page " & Str(srcPage) & " from " & srcFile & " was
            inserted before page " & Str(InsertBefore)
        MsgBox DropMsg, , "Drop Page"
    Next InsertCount
    Exit Sub
DropError:
    ImgThumbnail1.DropFailed = True
    MsgBox Err.Description, , "Drop Error" 
End Sub