| | |
Drag and drop from windows forms to desktop and windows explorer
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
Hello there, I've been having a hard time lately with implementing the drag and drop functionality outside the windows forms. I have no problem doing drag and drop within and between windows forms and from the desktop to the windows form. I have created an application where you can drag and drop any item on it. My problem is, I do not know how to implement the reverse of my application, to drag and drop from my app to the desktop or any destination outside my form. Any advise and ideas I will gratefully accept. Thank you.
An Avalanche In D Minor
I found a resource and tried it but it seems that when I try to drop my file to the desktop, nothing happens. I can drag it already but it cannot drop the file. Here's what I did:
It can drag already but cannot drop. What do you think is the problem?
C# Syntax (Toggle Plain Text)
private void listview_ItemDrag(object sender, ItemDragEventArgs e){ DataObject object = new DataObject() string f = listview.SelectedItems[0].Text; object.SetData(DataFormats.FileDrop, f); DoDragDrop(object, DragDropEffects.All); }
It can drag already but cannot drop. What do you think is the problem?
Last edited by murderotica; Jan 6th, 2009 at 5:17 am.
An Avalanche In D Minor
•
•
Join Date: May 2007
Posts: 81
Reputation:
Solved Threads: 1
hmmm... the only way I can think of to do that one is that to play with the location of the object that is being dragged.. so let's say while you
're dragging your object the X and Y Coordinates is updated.. now when you release the mouse, you try to check the X and Y coordinates of the object and if it is outside the bounds of the FORM, then you assume that the object has been dragged out of the form and perform the necessary event...
i haven't done this yet but give it a try and tell me if it worked
're dragging your object the X and Y Coordinates is updated.. now when you release the mouse, you try to check the X and Y coordinates of the object and if it is outside the bounds of the FORM, then you assume that the object has been dragged out of the form and perform the necessary event...
i haven't done this yet but give it a try and tell me if it worked
http://social.msdn.microsoft.com/for...-0421a6378b47/
This information seems hand, for files, but just for sake of working code, there is a codeproject example that has a demo app with source code of how to drag a url shortcut to the desktop from you application found here
http://www.codeproject.com/KB/cs/dra...tshortcut.aspx
I wish I had more, I have been putting off working this out for a feature in an app I'm working on myself.
best of luck.
This information seems hand, for files, but just for sake of working code, there is a codeproject example that has a demo app with source code of how to drag a url shortcut to the desktop from you application found here
http://www.codeproject.com/KB/cs/dra...tshortcut.aspx
I wish I had more, I have been putting off working this out for a feature in an app I'm working on myself.
best of luck.
![]() |
Similar Threads
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
Other Threads in the C# Forum
- Previous Thread: calling another form(frmreminder)
- Next Thread: How to display the data returned by select statement in a TextBox
| Thread Tools | Search this Thread |
.net 2007 access activedirectory algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion cryptographyc#winformsencryption csharp custom database datagrid datagridview dataset date datetime degrees development disabled displayingopenforms draganddrop drawing encryption enum eventcloseformc# excel file foreach form format forms ftp function gdi+ image index index-error input install java label list listbox listener listview load mandelbrot math mathematics mouseclick mysql operator path photoshop picturebox pixelinversion post prime programming radians regex remoting richtextbox security server setup sleep socket sql statistics stream string table text textbox thread time timer totaldays update user usercontrol validation visual visualstudio webbrowser windows winforms wpf xml






