從 c# winform 上拖曳一個 virtual file (比方說一個 label)到 explorer 或其他程式(例如 ultraedit, photoshop)開啟
I'd tried many other solutions found on Internet, but all of them are not well-functioned. After read some documents, I finally find the best and simplest (well, probably) solution.
private void label1_MouseDown(object sender, MouseEventArgs e) { DataObject dataObject = new DataObject(); System.Collections.Specialized.StringCollection xs = new System.Collections.Specialized.StringCollection(); xs.Add(@"E:\Photo\1.jpg"); dataObject.SetFileDropList(xs); DoDragDrop(dataObject, DragDropEffects.Copy); }