开发者

How to do DragAcceptFiles in C#?

I'm looking for the least painful way (that is, with the least code) to implement DragAcceptFiles on the main window of a C# project.

I've been searching on the net, and 开发者_如何学Pythonit looks like I'll have to DllImport DragAcceptFiles, and override WndProc to catch and handle WM_DROPFILES messages.

Doesn't the .net-framework provide this somewhere? Isn't there a proper way to add message handlers to a form other than overriding WndProc and have it do an extra if on almost all other messages that come through?


You can enable AllowDrop on the form and handle the DragDrop event. Take a look at the DragEventArgs class for the code for loading a file dropped onto a control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜