如何设置剪贴板复制文件?

编程入门 行业动态 更新时间:2024-10-15 18:23:56
本文介绍了如何设置剪贴板复制文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的申请,我允许用户选择对应于文件的盘上的项目。当用户presses按Ctrl + C,我要的文件发送到剪贴板,用户可以在其中粘贴文件的其他地方。

In my application, I allow the user to select items that correspond to files on a disk. When the user presses Ctrl+C, I want the file to be sent to the clipboard, where the user can then paste the file somewhere else.

我要实现它的方式,使用户可以复制,但我的应用程序中不糊。该用户就可以自由地将文件粘贴到将接受从剪贴板中的文件资源管理器或其他应用程序的实例。

I want to implement it in a way so that the user can copy, but not paste inside my application. The user is then free to paste the file into instances of Explorer or other applications that will accept the file from the clipboard.

我知道如何设置的剪贴板的内容,只是没有如何设置它,以便Windows识别为某些文件复制操作。

I know how to set information in the clipboard, just not how to set it so that Windows recognizes it as a copy operation for certain files.

我怎样才能做到这一点?

How can I accomplish this?

推荐答案

要赶上CTRL + C,你可以检查pssed的关键preSS事件钥匙$ P $。而复制文件(S)使用类似的东西如下:

To catch the CTRL + C you can check the Keys Pressed on the KeyPress event. And to copy the file(s) use something similar to below:

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); }

更多推荐

如何设置剪贴板复制文件?

本文发布于:2023-11-05 18:50:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1561582.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:剪贴板   如何设置   文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!