| | |
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 access algorithm alignment app array barchart bitmap box broadcast c# c#gridviewcolumn cast check checkbox client combobox communication control conversion csharp custom database datagrid datagridview dataset datatable datetime degrees development draganddrop drawing elevated encryption enum event excel file focus form format forms function gdi+ hospitalmanagementsystem httpwebrequest image index input install java label list listbox login mandelbrot math messagebox mouseclick mysql operator path photoshop picturebox pixelinversion plotting pointer post programming radians read regex remote remoting richtextbox server sleep socket sql statistics stream string stringformatting sun table text textbox thread time timer update usercontrol validation visualstudio webbrowser whileloop windows winforms wpf xml






