C#做浏览器,需要获取当前网页选中的内容

具体方法    引用--》COM--》Microsoft HTML Object Library

代码:

using mshtml;
  IHTMLDocument2 document = (IHTMLDocument2)web.Document.DomDocument;
  IHTMLTxtRange htmlElem = (IHTMLTxtRange)document.selection.createRange();
  string text = htmlElem.text; //选中的文字内容


相关文章:

  • 2021-12-31
  • 2022-12-23
  • 2021-07-10
  • 2021-05-20
  • 2021-08-05
  • 2021-04-30
猜你喜欢
  • 2021-09-06
  • 2022-12-23
  • 2021-07-22
  • 2022-01-28
  • 2021-11-17
  • 2022-12-23
相关资源
相似解决方案