Example





In This Topic
GdPicture14 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 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 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.

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.AllowDropFile")

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.AllowDropFile");

}
See Also