Drag and Drop issue with GoDiagram 2.6.2.2

Well, I didn’t think it all the way through. I got the source for those methods, but I just can’t insert them into my GoView override class, because those 2 methods contain references to private methods and member variables that are inaccessible from my override class.

I may try to use reflection to see if I can call any private methods or members. If there aren't many, it may not be too painful.
> GoView.DoExternalDrag now sets the Effect to DragDropEffects.Copy when CanInsertObjects() is true; it used to set the Effect to DragDropEffects.All. This certainly could be an issue, but according to what you have said, I believe this is not the issue in your application.
This turned out to be the problem. Using GoDiagram 2.6.2.2, I added the following override into my GoView class:
[code]
protected override void DoExternalDrag(DragEventArgs evt)
{
//FollowExternalDragImage(this.LastInput.DocPoint);
// Use reflection to call the private method:
Type goViewType = typeof(Northwoods.Go.GoView);
goViewType.InvokeMember("FollowExternalDragImage",
BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, this,
new object[] { this.LastInput.DocPoint });

if (CanInsertObjects())
{
//#if 2.5.2
evt.Effect = DragDropEffects.All; //#elif 2.6.1

//evt.Effect = DragDropEffects.Copy; //#endif
DoAutoScroll(this.LastInput.ViewPoint);
}
else
{
evt.Effect = DragDropEffects.None;
}
}
[/code]
and everything worked. If I uncomment the line "evt.Effect = DragDropEffects.Copy" then I get the problem I've been having.
So, I will try changing all my code back to what I had originally and then just setting Effect to "All" just after the call to base.DoExternalDrag().

Could you check to see if your override of GoView.GetExternalDragImage might be throwing an exception in 2.6.2? Or if adding the returned object to the GoView.Layers.Default layer might cause an exception?

Apparently when Control.OnDragEnter raises an uncaught exception Windows Forms treats it as DragDropEffects.None. Same goes for Control.OnDragOver.

(crossed posts)

OK, we're making progress.
I don't understand why that would make a difference. Is there some other part of your application where the DragEventsArgs.AllowedEffect might change the behavior?

Could you check to see if your override of GoView.GetExternalDragImage might be throwing an exception in 2.6.2? Or if adding the returned object to the GoView.Layers.Default layer might cause an exception?

It does not appear to be. I cleared the Visual Studio output panel before dragging over an item and did not see any "first chance exception" lines.
Then, I added a try/catch block around my code in GetExternalDragImage(), and no exception occurred.
> I don't understand why that would make a difference. Is there some other part of your application where the DragEventsArgs.AllowedEffect might change the behavior?
We're finally getting to the bottom of it.
Yes, the TreeView we are using is actually a class that is derived from Microsoft's TreeView. This derived class was written by a developer that is no longer with our company. In his event handler for TreeView.ItemDrag he calls DoDragDrop() with DragDropEffects.Move as the AllowedEffects parameter.
I am not sure why he chose to use Move rather than Copy or All, so I will have to do some investigation. Obviously, if I make that change it fixes my original problem as well.
Do you know why the change was made on your end from All to Copy?

Yes, we made that change because it was reported as a bug, since by default GoView doesn’t support Move or Link – just Copy.

If the dragged item isn't supposed to be removed from the TreeView, that code shouldn't be specifying Move.

Ok, thanks for all your help Walter.