I have TreeView, ListView and WebBrowser controls. I use the drag and drop method. With the TreeView and ListView everything works, because they have Dragdrop and DragEnter event. But I did not find them in WebBrowser.
I try using:
webBrowser1.Document.Body.Drag += new HtmlElementEventHandler(WebBrowser_Drag);
webBrowser1.Document.Body.DragOver += new HtmlElementEventHandler(WebBrowser_DragOver);
webBrowser1.Document.Body.DragEnd += new HtmlElementEventHandler(WebBrowser_DragEnd);
webBrowser1.Document.Body.DragLeave += new HtmlElementEventHandler(WebBrowser_DragLeave);
The DragOver and DragLeave events triggered, but it is not possible to change the cursor like
e.Effect = DragDropEffects.None;
The Drag and DragEnd events is not triggered.
I also try:
webBrowser1.Document.Body.AttachEventHandler("dragdrop", WebBrowser_DragDrop);
webBrowser1.Document.AttachEventHandler("dragdrop", WebBrowser_DragDrop);
webBrowser1.Document.AttachEventHandler("ondrop", WebBrowser_OnDrop);
webBrowser1.Document.Body.AttachEventHandler("ondrop", WebBrowser_OnDrop);
but it does not work well.
Now I have some questions:
- How to change the cursor in the event DragOver and DragLeave.
- Is there a way to process data as well as Dragdrop and DragEnter for WebBrowser?