WebBrowser控件说明(二)

WebBrowser 的事件
Private Events Description
BeforeNavigate2 导航发生前激发,刷新时不激发
CommandStateChange 当命令的激活状态改变时激发。它表明何时激活或关闭BackForward
菜单项或按钮
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有效或改变时激发

补充:

The NewWindow2 event

The NewWindow2 event occurs when a new window is to be created for displaying a resource. This event occurs before a new window is created from the WebBrowser control. For example, this event occurs in response to a navigation that is targeted to a new window or to a scripted window.open method.

To specify that your browser program is to be used when a new window is opened, set the ppDisp parameter equal to a new WebBrowser object that is contained in a new window that your program creates. In this scenario, if a user chooses to open a Web page in a new window, the new window in your program is used to display the new Web page.

Additionally, set the RegisterAsBrowser property to TRUE. This setting causes the new WebBrowser control to participate in window-name resolution. For example, if the window name is used elsewhere in the script, this control is used instead of a newly created one because the control examines all the existing window names before opening a new window.

以上两边文章资料来在网上。
posted on 2005-04-05 14:08  我在等待  阅读(1253)  评论(1)    收藏  举报