GdPicture.NET.14
GdPicture14 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.

Please check the corresponded GdViewer.DropFileEventHandler 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
Remarks
Please ensure that you have enabled the AllowDropFile property to benefit from using this event.
Example
How to add this event to your GdViewer control.
'We assume that the GdViewer1 control has been properly integrated.
Friend WithEvents GdViewer1 As GdPicture14.GdViewer
            
'Allowing to drop files.
GdViewer1.AllowDropFile = True
            
'Add the event.
AddHandler GdViewer1.DropFile, AddressOf GdViewer1_DropFile
            
'Define the event.
Sub GdViewer1_DropFile(ByVal FilePath As String) Handles GdViewer1.DropFile
    If GdViewer1.DisplayFromFile(FilePath) <> GdPictureStatus.OK Then
        MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DropFile")
End Sub
//We assume that the GdViewer1 control has been properly integrated.
            
//Allowing to drop files.
GdViewer1.AllowDropFile = true;
            
//Add the event.
GdViewer1.DropFile += GdViewer1_DropFile;
            
//Define the event.
void GdViewer1_DropFile(string FilePath)
{
    if (GdViewer1.DisplayFromFile(FilePath) != GdPictureStatus.OK)
        MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DropFile");
}
See Also