Sha*_*air 8 .net explorer drag-and-drop
我希望为用户提供将应用程序中的网格和其他控件中的文件拖放到资源管理器中的功能.那个好的样品/物品?
这非常简单,只需在MouseDown事件中调用DoDragDrop即可.你需要磁盘上的实际文件才能工作.
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);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1850 次 |
| 最近记录: |