在 WebBrowser 组件上放置项目时出现问题
我想将一些控件从自定义工具箱拖放到 WebBrowser 组件上。因为该组件不支持拖放,所以我使用包装器来捕获 DragEnter、DragOver 等。当应用程序仍配置为在 .NET Framework 2.0 中工作时,此方法运行良好。
由于某些原因,我不得不升级到 .Net Framework 4.0。我的包装器的所有拖放功能都已损坏。不会触发任何事件。像“导航”这样的事件仍然工作正常......
我已经准备好寻找可能的答案并尝试了一些方法,但我无法修复它。有人有任何线索吗?目前,我正在考虑实现以下位置给出的包装器: Codeproject
感谢您的宝贵时间!
编辑1(和2): 我继续寻找答案并发现了以下内容:
DragEnter 事件应该在某处触发,因为正确的图标出现在浏览器上。该图标似乎仅在正确设置 DragDropEffect 时才会出现。但我找不到 DragEnter 事件(或其他事件)的处理程序。
我试图将想要的项目放到另一个屏幕部分上。屏幕的这一部分不包含很多组件,因此在那里实现放置操作非常容易。而且效果很好。我能够从 eventArgs 中获取该对象。但它仍然无法在网络浏览器组件上运行。
也许这些线索可以帮助您解决这个问题。
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 method 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我实际开始工作的第一种方法是在 javascript 代码中添加一些事件和处理程序。我设置的事件是:
通过在 javascript 中处理这些事件并将事件发送到 C# 代码,我可以根据需要处理这些事件。
为了到达我正在拖动的控件,我实现了一个小“剪贴板”。通过这个静态类,我可以保留正在拖动的控件并从“onDragEnter”代码访问它。
The first way I actually got working is by adding some events and there handlers within javascript code. The events I've set are:
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.