Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2007

Tip: Looking for answers? Try searching our database.

conditional preventing of dragging files outside of my own app

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stephan Steiner - 29 Jun 2007 19:34 GMT
Hi

I'm currently working on an application which can be seen as sort of a
modern version of Norton Commander - I have a file list of a directory
on my local machine in a Listview in detail mode, and the same for a
remote location (not via SMB but a self-written remoting based API).

In order to make the application as useful as possible, I've added cut/
copy&paste and drag&drop operations. For each operation, I look at the
source and destination and then do the appropriate action (e.g. if you
drag a file to my left hand side listview.. it's a local copy/move
operation - if you drag it to the right hand side listview, the file
has to be uploaded to the remote machine). So far so good - there are
a few instances though where I'd like to prevent that information be
taken from the remote side and dropped into another file-capable
application (e.g. Windows Explorer) since in that case, the external
application would handle the drop operation and naturally it isn't
aware of all the conditions of my application.

So I looked at DragLeave and the GiveFeedback events... but the first
one gives me zero control over the DragDropEffect - and the latter
doesn't allow any modifications. Thus I'm left wondering if there's a
way to set the DragDropEffect to None when a drag operation
originating in my right hand side listview leaves the bounds of my
forum or of I have to resort to not using FileDrop for operations
originating from my remote side listview (which would be kinda
annoying seeing as operations that originate outside that listview
need to be in that format (since I want drag and drop TO the remote
machine)..

Regards
Stephan
Stephan Steiner - 30 Jun 2007 22:33 GMT
I've found a sample that appears to do what I need:
http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.queryconti
nuedrag.aspx


It makes use of the QueryContinueDrag event. So I've written an event
handler for my remote listview which mimics what is done in the
sample, but I never got the event the fire in the first place - but
when I searched for that behavior I found that I need to call
DoDragDrop on my listview - I used to call it on my main form.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.