C# 网页浏览器搜索功能(已编辑)
如何为网络浏览器控件构建自己的搜索功能,并在可能的情况下删除内置搜索功能(即 CTRL + F 查找功能)?任何有关此问题的帮助将不胜感激。
编辑 - 我如何搜索文本并选择它?与查找对话框如何查找文本并选择它非常相似,我想这样做,并且我已经弄乱了页面的文档属性,但我仍然无法让它工作。有什么帮助吗?
How can I build my own search function for the webbrowser control, and if possible remove the built-in one (CTRL + F find function, that is)? Any help regarding this would be appreciated.
Edit - How would I search for text and select it? Pretty much like how the find dialog will find text and select it, I want to do that and I have messed with the document property of the page but I still can't get it to work. Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是
WebBrowser
控件的用途。您可以使用第三方浏览器控件来代替:
GeckoFX
Mono.WebBrowser
更新(以下评论):
您可以捕获控件的
KeyPress
事件来查找是否按下了ctrl+f,然后在控件返回的文档上使用您自己的搜索算法。我希望您也应该能够对第三方控件执行类似的操作。
That is the purpose of the
WebBrowser
control.There are third party browser controls you can use instead:
GeckoFX
Mono.WebBrowser
Update (following comments):
You can capture the
KeyPress
events of the control to find out if ctrl+f was pressed, then use your own search algorithm on the document returned by the control.I expect you should be able to do something similar with the third party controls as well.