/// <summary> /// Handle when a file is dragged and dropped onto the PDFView Control /// </summary> private void PDFViewer_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { // Note: Assuming only 1 file was dropped string[] file_paths = (string[])e.Data.GetData(DataFormats.FileDrop); if (file_paths.Length > 0) { // Let's only handle the first file dropped string file_path = file_paths[0]; if (System.IO.Path.GetExtension(file_path) != ".pdf") { return; } PDFDoc doc = new PDFDoc(file_path); PDFViewer.SetDoc(doc); } } }