c#form drag(不删除)文件onclick
我希望,当您激活元素的onclick事件时,它会给我一个附加到鼠标的文件,例如使用拖放功能时。
我不想放下文件,我想从表单中拖动它,有什么方法可以做到这一点?
编辑: 我已经取得了一些进步...这是我的onclick事件的代码:
private void DragArchivo(object sender, MouseEventArgs e)
{
DoDragDrop(File.Create(ruta), DragDropEffects.Copy | DragDropEffects.Move);
}
我有一个名为ruta的根源,指向AC#脚本:
C:\\Users\\Usuario\\Documents\\GitHub\\blabla\\blablaCommand.cs
这已经适用于拖动字符串之类的东西,但我不能这样做。
I want that when you activate the onclick event of an element it gives me a file attached to my mouse like when you use the drag And Drop function.
I dont want to drop a file, i want to drag it from the form, there is some way to do this?
Edit:
I have made some progress... this is my code now for the onclick event:
private void DragArchivo(object sender, MouseEventArgs e)
{
DoDragDrop(File.Create(ruta), DragDropEffects.Copy | DragDropEffects.Move);
}
I have an absolute root named ruta that point to a c# script:
C:\\Users\\Usuario\\Documents\\GitHub\\blabla\\blablaCommand.cs
This already works for dragging things like strings but i cant do it work whit files.
By the way, the objetive is to grab files from my program and drop them into visual studio to work whit it:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果某人将来有同样的问题,这里是一个非常酷的人,它找到了解决方案:
“ rel =“ nofollow noreferrer”我最终使用的是:
If someone has the same problem in the future here is a very cool person that has found the solution:
https://www.codeproject.com/Questions/576279/DragplusfileplusOUTplusofplusapplication
The code that i have finaly used is: