C# 中引用IHTMLDocument2

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

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

代码:

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


原文地址:https://www.cnblogs.com/whisht/p/3085061.html