Problem dropping item on WebBrowser component
I would like to drop some controls from a self-defined toolbox onto a WebBrowser component. Because this component doesn't support drag-drop I use a wrapper to catch DragEnter, DragOver, ... This m开发者_运维技巧ethod worked fine while the application was still configured to work in .NET framework 2.0.
For some reasons I had to upgrade to .Net framework 4.0. All drag and drop functionality with my wrapper is broken. No events are triggered whatsoever. Events like "navigated" are still working fine...
I allready searched for possible answer and tried a few things but I couldn't fix it. Does anybody has any clue? Currently I'm thinking about implementing the wrapper given at: Codeproject
Thanks for your time!
EDIT 1 (& 2): I continued my search for answers and discovered the following stuff:
The DragEnter-event should be fired somewhere because the right icon appears on the browser. This icon only seems to appear when a DragDropEffect is set correctly. But I can't find the handler for the DragEnter-event (or other).
I tried to drop the wanted item onto an other screen part. This part of the screen doesn't contain a lot of components so it was pretty easy to implement the drop-action there. And it worked fine. I was able to get the object out of the eventArgs. But it's still not working on the webbrowser-component.
Maybe these clues can help you to sort out this problem.
The first way I actually got working is by adding some events and there handlers within javascript code. The events I've set are:
- ondragenter
- ondragover
- ondragleave
- ondrop (NOT ondragdrop !!!)
By handling these events within javascript and sending the event to C#-code I could handle these events as wanted.
To get to the control I'm dragging I implemented a little "clipboard". With this static class I'm able to hold the control I'm dragging and access it from the "onDragEnter"-code.
精彩评论