使用Windows默认副本 [英] Using Windows default copy
本文介绍了使用Windows默认副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以通过按钮调用Windows的复制事件吗?例如,我将文件添加到列表框中并选择目标驱动器,然后按按钮时,它应该复制文件.就像我将其(文件)拖到Windows资源管理器中的可移动磁盘上或在发送至"菜单中选择驱动器一样.
Is there any way that i can call windows'' copy event from a button. like, i add files to a list box and select a destination drive, and when i press the button, it should copy the files. same as it would do if i dragged it(the files) onto the removable disk in windows explorer or selecting the drive in the send to menu.
推荐答案
通过Shell文件操作(SHFileOperation)完成.查看链接以获取更多信息和示例:
C#可以Shell,第2部分 [
It can be done with a Shell file operation (SHFileOperation). Check out the link for more info and examples:
C# does Shell, Part 2[^]
Good luck!
使用<a href="http://msdn.microsoft.com/en-us/library/system.io(v=VS.80).aspx">System.IO namespace</a>[<a href="http://msdn.microsoft.com/en-us/library/system.io(v=VS.80).aspx" target="_blank" title="New Window">^</a>]
中类<a href="http://msdn.microsoft.com/en-US/library/system.io.file(v=VS.80).aspx">File</a>[<a href="http://msdn.microsoft.com/en-US/library/system.io.file(v=VS.80).aspx" target="_blank" title="New Window">^</a>]
的静态方法<a href="http://msdn.microsoft.com/en-us/library/c6cfw35a(v=VS.80).aspx">Copy(String, String)</a>[<a href="http://msdn.microsoft.com/en-us/library/c6cfw35a(v=VS.80).aspx" target="_blank" title="New Window">^</a>]
或<a href="http://msdn.microsoft.com/en-us/library/9706cfs5(v=VS.80).aspx">Copy(String, String, bool)</a>[<a href="http://msdn.microsoft.com/en-us/library/9706cfs5(v=VS.80).aspx" target="_blank" title="New Window">^</a>]
.
干杯!
—MRB
Use the static method<a href="http://msdn.microsoft.com/en-us/library/c6cfw35a(v=VS.80).aspx">Copy(String, String)</a>[<a href="http://msdn.microsoft.com/en-us/library/c6cfw35a(v=VS.80).aspx" target="_blank" title="New Window">^</a>]
or<a href="http://msdn.microsoft.com/en-us/library/9706cfs5(v=VS.80).aspx">Copy(String, String, bool)</a>[<a href="http://msdn.microsoft.com/en-us/library/9706cfs5(v=VS.80).aspx" target="_blank" title="New Window">^</a>]
of class<a href="http://msdn.microsoft.com/en-US/library/system.io.file(v=VS.80).aspx">File</a>[<a href="http://msdn.microsoft.com/en-US/library/system.io.file(v=VS.80).aspx" target="_blank" title="New Window">^</a>]
from the<a href="http://msdn.microsoft.com/en-us/library/system.io(v=VS.80).aspx">System.IO namespace</a>[<a href="http://msdn.microsoft.com/en-us/library/system.io(v=VS.80).aspx" target="_blank" title="New Window">^</a>]
.
Cheers!
—MRB
这篇关于使用Windows默认副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文