简体   繁体   English

C#/ WPF:与Web浏览器控件的交互?

[英]C#/WPF: interaction with web browser control?

Is it possible to interact with the source code of a local or remote page in real time through the use of the WPF browser control. 是否可以通过使用WPF浏览器控件与本地或远程页面的源代码进行实时交互。

A simple example of what I mean would be where the user can click a button that will bold the selected text. 我的意思的一个简单示例是用户可以单击将加粗所选文本的按钮。 Sort of like a WYSIWYG HTML editor but using the browser control. 有点像WYSIWYG HTML编辑器,但是使用浏览器控件。

Is there a way to interact with the source code like this with the same power you have with JavaScript. 有没有办法像这样与源代码进行交互,并且具有与JavaScript相同的功能。 Would one have to set up a system to parse the selected web page and then modify its code and then reopen the new code in the browser control to simulate the experience of real time editing? 是否需要设置一个系统来解析所选网页,然后修改其代码,然后在浏览器控件中重新打开新代码以模拟实时编辑的体验?

Thanks 谢谢

You have full DOM access through the webbrowser control, so the answer is yes. 您可以通过webbrowser控件完全访问DOM,因此答案是肯定的。 However, the webbrowser control is not a wpf control but a winforms control, and in order to use it you would have to use the wpf winforms container control. 但是,webbrowser控件不是wpf控件,而是winforms控件,要使用该控件,必须使用wpf winforms容器控件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM