Drag Drop from .NET application to Explorer

后端 未结 2 2017
栀梦
栀梦 2020-12-03 18:20

I\'m looking to provide users with ability to drag&drop files from grids and other controls in my application into Explorer. Any good samples/articles for that?

相关标签:
2条回答
  • 2020-12-03 19:13

    Here is a sample application but it cannot handle large files: Transferring Virtual Files to Windows Explorer in C#

    0 讨论(0)
  • 2020-12-03 19:14

    It's pretty straight-forward, just call DoDragDrop in a MouseDown event. You'll need actual files on disk for this to work.

    private void Form1_MouseDown(object sender, MouseEventArgs e) { 
       string[] files = new string[] { @"c:\temp\test.txt" };
       this.DoDragDrop(new DataObject(DataFormats.FileDrop, files), DragDropEffects.Copy); 
    }
    
    0 讨论(0)
提交回复
热议问题