Example





In This Topic
GdPicture14.WPF Namespace / GdViewer Class / AllowDropFile Property

AllowDropFile Property (GdViewer)

In This Topic
Specifies if a user is able to drag-and-drop files from the file explorer directly to the control, for example using the mouse.

If this property is set to true and a file is dropped within the control, the DropFile event, respectively the PreviewDropFile event, is raised.

Syntax
'Declaration
 
Public Property AllowDropFile As Boolean
public bool AllowDropFile {get; set;}
public read-write property AllowDropFile: Boolean; 
public function get,set AllowDropFile : boolean
public: __property bool get_AllowDropFile();
public: __property void set_AllowDropFile( 
   bool value
);
public:
property bool AllowDropFile {
   bool get();
   void set (    bool value);
}

Property Value

The default value is false.
Remarks
Please note that the inherited AllowDrop property is also set to the specified value. Likewise, the DropFile event, respectively the PreviewDropFile event, is raised if drag-and-drop is enabled and a file is dropped within the control.
Example
How to allow using drag-and-drop feature in the GdViewer control.
'We assume that the GdViewer1 control has been properly integrated
'and the event has been properly added as well.
            
'Allowing to drop files.
GdViewer1.AllowDropFile = True
            
'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.AllowDropFile")
        Endif
    Endif
End Sub
//We assume that the GdViewer1 control has been properly integrated
//and the event has been properly added as well.
            
//Allowing to drop files.
GdViewer1.AllowDropFile = true;
            
//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.AllowDropFile");
}
See Also