i’ve overriden the
protected override void OnDragDrop(DragEventArgs evt){
… Objects to add
this.Document.Add(obj);
}
on GoView. Now I’ve an shadow Object (image which shows on move) and the object in my GoView. But why does the image stay there? when i call
base.OnDragDrop(evt);
i’ve the Object twice and now image…
which part must i reset or repaint?
What do you want to accomplish? Do you really want to do something on every possible drop? Or just for drag-and-drops that start and end within that GoView? Or just for moves or copies of GoObjects within the view?
The issue is that mouse-down-move-mouse-up gets used in a lot of different ways for a lot of different purposes.
If you want to provide images for data being dragged in from other non-GoView controls, you can override GoView.GetExternalDragImage.
If you want to customize what happens during a drag of the selection, i.e. a move or a copy, you should customize the GoToolDragging tool that the view is using.
i want to do something with the objects wich are dropped on my GoView… from the GoPalette, but i want to modfiy the objects which are added to the document of my vie and not the dragged on from the palette. But with MyView_DragDrop(object sender, DragEventArgs e){
} i get only the objects from the palette…
Instead of defining a Control.DragDrop event handler, define a GoView.ExternalObjectsDropped event handler. This event is raised after GoObjects have been dropped onto your GoView and been made the view’s Selection. (Alternatively, override GoView.DoExternalDrop and call the base method first.)
So your event handler can just iterate over the GoView.Selection and decide what to do.
As always, remember not to change a collection while you are in a loop that is enumerating it, for example by deleting those objects or by just removing them from the GoView.Selection. Instead, iterate over a copy of the selection if you might need to remove/delete:
foreach (GoObject obj in goView1.Selection.CopyArray()) { … }