日期:2014-05-19  浏览次数:20758 次

如何实现用鼠标左键将文件拖入窗体,就打开文件这个功能?
这个在MFC中学习过,但是在c#的窗体程序中不知道怎么实现,看过一些教程里好像也没有。

------解决方案--------------------
Drag and drop, cut/copy and paste files with Windows Explorer
http://www.codeproject.com/csharp/Explorer_Drag_Drop.asp


------解决方案--------------------
Programming Microsoft Windows with CSharp第24章
------解决方案--------------------
DragQueryFile()、DragAcceptFiles()、DragFinish()。 这三个函数
我原来一程序是在delphi中调用使用成功,C#也应该能用的.只是在调用这些api时麻烦些.具体你还是看看相关c#中怎么调用api之类的文章。肯定能实现的.
------解决方案--------------------
应该可以通过窗体的dargenter和gragdrop事件处理