whisht

    十年

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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

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

代码:

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


posted on 2013-04-11 17:48  WHISHT  阅读(1564)  评论(0编辑  收藏  举报