在我的申请,我允许用户选择对应于文件的盘上的项目。当用户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); }更多推荐
如何设置剪贴板复制文件?
发布评论