惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
A
About on SuperTechFans
J
Java Code Geeks
G
Google Developers Blog
L
LangChain Blog
小众软件
小众软件
宝玉的分享
宝玉的分享
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
博客园 - 【当耐特】
IT之家
IT之家
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
博客园 - Franky
博客园_首页
雷峰网
雷峰网
Microsoft Security Blog
Microsoft Security Blog
Vercel News
Vercel News
B
Blog
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell

博客园 - huadust

msdn 网络编程 委托用法 注册表操作 DateTime各种用法 [转]将dll汇入exe 用DataTable构建树 Lock Review String Review Class Review DataTable opertion Drag DataGridView Data To TreeView 2009_01_15_星期三 2009_01_02_星期五 2008_12_31_星期三 2008_12_24_星期三 2008_12_20_星期六 2008_12_17_星期三 2008_12_04_星期四
2008_12_06_星期六
huadust · 2008-12-06 · via 博客园 - huadust

今天北京的气温比前二天好多了,风也小了不少。

今天周末来公司加班,主要是找了WebBrowser的一些使用方法,其中最主要的还是查看选定区域的源码功能。

//IHTMLDocument 接口没多大用, 只有个Script属性, 是管理页面脚本用的
//IHTMLDocument2接口用起来其实跟C#的HtmlDocument类(System.Windows.Forms.HtmlDocument)差不多的
//IHTMLDocument3就是跟VB6里的文档对象差不多的一个接口, 推荐大家都用这个, 基本上要用的方法都在
//IHTMLDocument4接口是跟导航有关的吧
//IHTMLDocument5接口几乎都是事件管理的成员

IHTMLDocument2 htmlDoc 
= (IHTMLDocument2)wb_Browser.Document.DomDocument;
IHTMLTxtRange select 
= (IHTMLTxtRange)htmlDoc.selection.createRange();
if (select != null)
{
    selectHtmlCode 
= select.htmlText;
}

其中 mshtml 是个非常有用的类。

下面是设置WebBrowser为可编辑状态的语句是

//m1
HTMLDocument htmlDoc = (HTMLDocument)wb_Browser.Document.DomDocument;
htmlDoc.designMode 
= "On";//m2
wb_Browser.Document.DomDocument.GetType().GetProperty("designMode").SetValue(wb_Browser.Document.DomDocument, "On"null);