Need DropFile example for dragging multiple files at once

Example requests & Code samples for GdPicture Toolkits.
Post Reply
grama
Posts: 2
Joined: Thu Oct 18, 2012 9:09 pm

Need DropFile example for dragging multiple files at once

Post by grama » Mon Jun 10, 2013 9:51 pm

ActiveX version had a "dropfiles" event where we could handle multiple files being dropped by the user from a Windows Explorer window. The newer 9.4 .Net version only provide support for "dropfile" event, and only recognize the last file.

How can I recreate this functionality of accepting multiple files at once in the viewer and process them one after the other (I would add pages to the current document.

thx in advance.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Need DropFile example for dragging multiple files at onc

Post by Loïc » Wed Jun 12, 2013 1:31 pm

Hello,

You have to catch the DragDrop event like any other user control. This is quite easy, here an example in vb.net:

Code: Select all

 Private Sub GdViewer1_DragEnter(sender As Object, e As DragEventArgs) Handles GdViewer1.DragEnter
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            e.Effect = DragDropEffects.All
        End If
    End Sub

    Private Sub GdViewer1_DragDrop(sender As Object, e As DragEventArgs) Handles GdViewer1.DragDrop
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            Dim files() As String = CType(e.Data.GetData(DataFormats.FileDrop), String())
            'do something with files() here
        End If
    End Sub
Kind regards,

Loïc

grama
Posts: 2
Joined: Thu Oct 18, 2012 9:09 pm

Re: Need DropFile example for dragging multiple files at onc

Post by grama » Wed Jun 19, 2013 3:24 pm

I'm using the INTEROP module with VB6, and there seems to be no DragEnter event available.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest