WebBrowser control common methods, properties, and events

1. Properties

Attributes Explanation
Application If the object is valid, in charge of the automation object WebBrowser control application realized returns (IDispatch). If the object is not valid in the host automation object, the program will return WebBrowser
automation object control
Parent Returns the parent WebBrowser control automation object, typically a container, such as a host or IE window
Container Returns the automation object WebBrowser control container. Typically the value returned by the same Parent property
Document Returns the automation object for the active document. If HTML is currently being displayed in the WebBrowser, then
provide access to the DHTML Object Model Document property
TopLevelContainer
It returns a Boolean value indicating whether the WebBrowser control IE is top container, a return true
Type The return type has been loaded WebBrowser control object. For example: If you load a .doc file, it will return
back to Microsoft Word Document
Left Back WebBrowser control distance or disposed inside the left side of the window and the container left of the window
Top From the top edge or return provided WebBrowser control window and the left side of the container inside the window
Width WebBrowser returns or sets the width of the window, in pixels
Height WebBrowser returns or sets the height of the window in pixels
LocationName Returns a string that contains the name of the resource WebBrowser currently displayed, if the resource
is a web page is the title of the page; if the file or folder, that file or folder name
LocationURL WebBrowser returns a resource currently being displayed in the URL
Busy Returns a Boolean value, indicating whether the WebBrowser is currently being loaded URL, it returns true if
you can use the stop method to revoke access operation is being performed

2. Methods

method Explanation
GoBack Equivalent to IE's " back " button, so you step backward in the current history list
GoForward Equivalent to IE's " forward " button, so that you step forward in the current history list
GoHome Equivalent to IE's " home " button, connect the user's default home page
GoSearch Equivalent to IE's " search " button to connect the user's default search page
Navigate Connect to the specified URL
Refresh Refresh the current page
Refresh2
Above, but can be specified level refresh, the refresh-level value specified from RefreshConstants enumeration table that defines the ExDisp.h, the different values that can be specified as follows:
REFRESH_NORMAL perform simple refresh does not HTTP pragma: no- cache headers to the server
REFRESH_IFEXPIRED only a simple refresh the page after the expiration
REFRESH_CONTINUE for internal use only. Says DO NOT USE Do not use the MSDN years!
REFRESH_COMPLETELY will contain the pragma: no-cache header sends a request to the server
Stop 相当于IE的“ 停止 ”按钮,停止当前页面及其内容的载入

3. 事件

Private Events Description
BeforeNavigate2 导航发生前激发,刷新时不激发
CommandStateChange 当命令的激活状态改变时激发。它表明何时激活或关闭Back和Forward 菜单项或按钮
DocumentComplete 当整个文档完成是激发,刷新页面不激发
DownloadBegin 当某项下载操作已经开始后激发,刷新也可激发此事件
DownloadComplete 当某项下载操作已经完成后激发,刷新也可激发此事件
NavigateComplete2 导航完成后激发,刷新时不激发
NewWindow2 在创建新窗口以前激发
OnFullScreen 当FullScreen属性改变时激发。该事件采用VARIENT_BOOL的一个输 入参数来指示IE是全屏显示方式(VARIENT_TRUE)还是普通显示方式(VARIENT_FALSE)
OnMenuBar 改变MenuBar的属性时激发,标示参数是VARIENT_BOOL类型的。 VARIANT_TRUE是可见,VARIANT_ FALSE是隐藏
OnQuit 无论是用户关闭浏览器还是开发者调用Quit方法,当IE退出时就会激发
OnStatusBar 与OnMenuBar调用方法相同,标示状态栏是否可见。
OnToolBar 调用方法同上,标示工具栏是否可见。
OnVisible 控制窗口的可见或隐藏,也使用一个VARIENT_BOOL类型的参数
StatusTextChange 如果要改变状态栏中的文字,这个事件就会被激发,但它并不理会程序是否有状态栏
TitleChange Title有效或改变时激发

转载于:https://www.cnblogs.com/rainman/archive/2013/06/04/3116471.html

Guess you like

Origin blog.csdn.net/weixin_34150224/article/details/93561331