private void Form1_DragEnter(object sender, DragEventArgs e) { // 當滑鼠拖曳進視窗,改變鼠標 if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; } private void Form1_DragDrop(object sender, DragEventArgs e) { // 當拖曳進來檔案放開滑鼠按鍵時,呼叫本函式 string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (string file in files) Console.WriteLine(file); }