Dave
Sat Nov 25 23:53:37 CST 2006
Hi Lloyd,
The key is that your drop targets must be aware of the source, not the other
way around.
You may want to read the following article:
"Performing Drag and Drop Operations"
http://msdn2.microsoft.com/en-gb/library/ms973845.aspx
(The article uses VB.NET; sorry :)
--
Dave Sexton
"Lloyd Dupont" <net.galador@ld> wrote in message
news:%23%23xYcz8DHHA.3520@TK2MSFTNGP04.phx.gbl...
> No, it didn't H!
>
> Perhaps I was not clear enough?
> I'm trying to do something which looks impossible with the public .NET
> API, yet Word and OpenOffice manage it.
>
>
> In pseudo code it will look like that:
>
> if(target == this)
> AllowedEffect = Copy | Move;
> else
> AllowedEffect = Copy;
>
> Of course the source should update the AllowedEffect every time the target
> change. Which is not possible with the API, yet Word manage to do it.
> So I wonder how it does it...
>
>
> "Ciaran O''Donnell" <CiaranODonnell@discussions.microsoft.com> wrote in
> message news:793E0F3F-DABF-44DC-B1AF-400EAD5376D5@microsoft.com...
>> The DragDropEffects enum is a Flags enum so when DoDrapDrop'ing at the
>> source, if the data can be moved or copied then you set the effect to
>> DragDropEffects.Copy | DragDropEffects.Move
>> The when the destination handles drag enter, that can decide whether it
>> should be copied or moved to it.
>> I generally like to make a struct or class to hold more information that
>> the
>> dragdrop'd data like the source object and anythign else used in the
>> descision. Then if dragging to another part of my app then i can handle
>> it
>> easily.
>>
>> HTH
>>
>> Ciaran O'Donnell
>>
>> "Lloyd Dupont" wrote:
>>
>>> If I use software like OpenOffice and try to drag text I could notice
>>> that
>>> 1. when I drag inside the document I'm moving the text
>>> 2. when I drag outside the document I'm copying the text
>>>
>>> Yet it all looks like one smooth operation. With correct cursor feedback
>>> (the little + marker next to the icon).
>>> My problem is, once I call DoDragDrop() it's blocking, I have no other
>>> opportunities to change the AllowedEffect to only Copy if I drag over,
>>> say,
>>> an other control
>>>
>>> And QueryContinueDrag:
>>> 1. don't allow me to change the efect
>>> 2. don't inform me about the current drop target
>>>
>>> How could I do that?
>>> (i.e. how could I modify the allowed efffect depending on the target
>>> (i.e.
>>> wether it's me or not))
>>>
>>>
>>>
>
>