积极答复者
如何实现在我的应用程序和Explorer之间复制、粘贴文件

问题
答案
-
Hi,
>>1> 在Explorer中,选择一些文件并按下Ctrl+C,切换到我的应用程序,点击Button1,将这些文件复制到指定文件夹
这个用IO和剪贴板都可以操作:
private void Copy(string[] pathArray) { StringCollection sc = new StringCollection(); sc.AddRange(pathArray); Clipboard.SetFileDropList(sc); } private void Paste(string[] pathArray) { Clipboard.GetFileDropList().CopyTo(pathArray, 0); }
Regards,
Moonlight
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 sincos2007 2016年6月15日 2:11
全部回复
-
private void CopyFile(string[] ListFilePaths)
{
System.Collections.Specialized.StringCollection FileCollection = new System.Collections.Specialized.StringCollection();
foreach(string FileToCopy in ListFilePaths)
{
FileCollection.Add(FileToCopy);
}
Clipboard.SetFileDropList(FileCollection);
}https://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard.setfiledroplist.aspx
专注于.NET ERP/CRM开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms
-
Hi,
>>1> 在Explorer中,选择一些文件并按下Ctrl+C,切换到我的应用程序,点击Button1,将这些文件复制到指定文件夹
这个用IO和剪贴板都可以操作:
private void Copy(string[] pathArray) { StringCollection sc = new StringCollection(); sc.AddRange(pathArray); Clipboard.SetFileDropList(sc); } private void Paste(string[] pathArray) { Clipboard.GetFileDropList().CopyTo(pathArray, 0); }
Regards,
Moonlight
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 sincos2007 2016年6月15日 2:11