打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
HtmlWindow.Frames 属性 获取在网页中定义的每个 FRAME 元素的一个引用。

HtmlWindow.Frames 属性

获取在网页中定义的每个 FRAME 元素的一个引用。

 

命名空间:  System.Windows.Forms
程序集:  System.Windows.Forms(在 System.Windows.Forms.dll 中)
public HtmlWindowCollection Frames { get; }

属性值

类型:System.Windows.Forms.HtmlWindowCollection
文档的 FRAMEIFRAME 对象的 HtmlWindowCollection

FRAME 是在 FRAMESET 中定义的一组窗口。 FRAME 使单个文档中可以承载多个文档。 每个 FRAME 定义为占据一定的行和列宽度,并在页上相对于 FRAMESET 内定义的其他 FRAME 进行定位;FRAME 的位置是固定的,尽管用户有时可以使用鼠标光标放大或缩小 FRAME IFRAME 类似于框架,但它不需要锚定到一个固定位置。

框架将包含网页中定义的每个 FRAMEIFRAMEHtmlWindow 的一个实例。

下面的代码示例在一个包含框架的页中检查每个文档,然后创建一个表,该表由每一页的所有输出超链接组成,供以后检查使用。

		private void GetLinksFromFrames(){Hashtable linksTable = new Hashtable();string frameUrl;if (!(webBrowser1.Document == null)){HtmlWindow currentWindow = webBrowser1.Document.Window;if (currentWindow.Frames.Count > 0){foreach (HtmlWindow frame in currentWindow.Frames){frameUrl = frame.Url.ToString();Hashtable frameLinksHash = new Hashtable();linksTable.Add(frameUrl, frameLinksHash);foreach (HtmlElement hrefElement in frame.Document.Links){frameLinksHash.Add(hrefElement.GetAttribute("HREF"), "Url");}}}else{Hashtable docLinksHash = new Hashtable();linksTable.Add(webBrowser1.Document.Url.ToString(), docLinksHash);foreach (HtmlElement hrefElement in webBrowser1.Document.Links){docLinksHash.Add(hrefElement.GetAttribute("HREF"), "Url");}}}}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

.NET Framework

受以下版本支持:4、3.5、3.0、2.0

.NET Framework Client Profile

受以下版本支持:4
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
WPF 与网页交互(Frame,WebBrowser)(
Delphi中WebBrowser的使用技巧汇总
利用Java实现网页浏览器二
如何:创建 C# Windows 窗体应用程序
Win32控件使用大全
Windows Phone开发(1):为Window Phone开发第一个Silverlight应用
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服