GdPicture.NET.14
GdPicture14.WPF Namespace / GdViewer Class / DropFile Event
Example





In This Topic
DropFile Event (GdViewer)
In This Topic
This event is raised when a file has been dropped in the current GdViewer control using the drag-and-drop feature. The event is explicitly raised when the AllowDropFile property is set to true.

The event makes use of bubble routing strategy. Please check the corresponded GdViewer.DropFileEventArgs for given parameters.

Syntax
'Declaration
 
Public Event DropFile As GdViewer.DropFileEventHandler
public event GdViewer.DropFileEventHandler DropFile
public event DropFile: GdViewer.DropFileEventHandler; 
In JScript, you can handle the events defined by another class, but you cannot define your own.
public: __event GdViewer.DropFileEventHandler* DropFile
public:
event GdViewer.DropFileEventHandler^ DropFile
Event Data

The event handler receives an argument of type GdViewer.DropFileEventArgs containing data related to this event. The following GdViewer.DropFileEventArgs properties provide information specific to this event.

PropertyDescription
The array of file paths of the files that are dropped in the control.  
(Inherited from System.Windows.RoutedEventArgs)
(Inherited from System.Windows.RoutedEventArgs)
(Inherited from System.Windows.RoutedEventArgs)
(Inherited from System.Windows.RoutedEventArgs)
Remarks
Please ensure that you have enabled the AllowDropFile property to benefit from using this event.
Example
How to utilize this event in your GdViewer control.
'We assume that the GdViewer1 control has been properly integrated
'and the DropFile event has been properly added.
            
'Define the event.
Sub GdViewer1_DropFile(ByVal sender As Object, ByVal e As GdPicture14.WPF.GdViewer.DropFileEventArgs)
    If e.File.Length > 0 Then
        If GdViewer1.DisplayFromFile(e.File(0)) <> GdPictureStatus.OK Then
            MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DropFile")
        End If
    End If
End Sub
//We assume that the GdViewer1 control has been properly integrated
//and the DropFile event has been properly added.
            
//Define the event.
void GdViewer1_DropFile(object sender, GdPicture14.WPF.GdViewer.DropFileEventArgs e)
{
    if (e.File.Length > 0)
    {
        if (GdViewer1.DisplayFromFile(e.File[0]) != GdPictureStatus.OK)
            MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DropFile");
    }
}
See Also