C# : Drag and Drop Files
Created 20 August 2001 00:00
When coding drag and drop operations in C# Windows applications, you need to complete two steps. Firstly, add a DragOver event to your form in which you change the cursor over your target application so the user can see they will copy the dragged object on the form:
  private void event_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
  {
    e.Effect = DragDropEffects.Copy;
  }
The second step involves handling the actual dropping of the file. This is done by adding a DragDrop event to your form, and retrieving the string array which Windows passes to your application containing the names of all the files dragged and dropped:
  private void event_DragDrop(object sender, DragEventArgs e) 
  {
    // get reference to the dataobject
    DataObject dataObj = (DataObject)e.Data;
    // convert into array of file names
    string[] files = (string[])(dataObj.GetData(DataFormats.FileDrop));
    // loop through each argument, performing the appropriate file opening
    for (int i=0; i<files.Length; i++) 
    {
      this.OpenFile(files[i]);
    }
  }
C#: Opening external applications
Created 22 August 2001 00:00
Opening files from within your application that you do not want to handle within the application itself is really simple using the System.Diagnostics namespace.

Eg: to open the user's default browser to a web site:

  try 
  {
    System.Diagnostics.Process.Start("http://yoursite.com");
  }
  catch (Exception) 
  {
    // error handling
  }

Eg: To open the user's mail client to send mail to someone:

  try 
  {
    System.Diagnostics.Process.Start("mailto: someone@somewhere.com");
  }
  catch (Exception) 
  {
    // error handling
  }

Eg: To open a gif file:

  try 
  {
    System.Diagnostics.Process.Start("C:/YourFile.gif");
  }
  catch (Exception) 
  {
    // error handling
  }