首先在from_load事件中添加以下代码:  

编辑模式
webBrowser1.DocumentText = string.Empty;
webBrowser1.Document.ExecCommand(
"EditMode", false, null); // 编辑模式
webBrowser1.Document.ExecCommand("LiveResize", false, null);
webBrowser1.DocumentText
= @"现在";


然后webBrowser1里面内容就可以编辑了

其中如果需要得到webBrowser1中的内容可以使用:

webBrowser1.Document.Body.InnerText 和 webBrowser1.Document.Body.InnerHtml

从字面意思上可以看出是分别获取webBrowser1的文本形式内容和html形式内容。


本文来自: 张筱祥博客(www.zxxblog.com) 详细出处参考:http://www.zxxblog.com/838

WebBrowser1.Document.ExecCommand ("BrowseMode", true, Null); //浏览模式

相关文章:

  • 2021-10-29
  • 2021-05-31
  • 2021-10-09
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-07-06
猜你喜欢
  • 2022-12-23
  • 2021-07-31
  • 2021-12-19
  • 2021-12-09
  • 2022-01-12
相关资源
相似解决方案