VB calls WebBrowser Tips 3

zhaozj2021-02-16  90

1, the page scrolles:

Private submmand2_click () webbrowser1.document.parentWindow.Scrollby 0, 30nd Sub

Private Sub Form_Load () WebBrowser1.naVigate "http://www.applevb.com" end SUB

Click Command2 to make the current page to scroll down 30 pixels down

2. Determine if the page can be forwarded back

Private Sub Command1_Click () WebBrowser1.goforwardend Sub

Private submmand2_click () WebBrowser1.gobackend Sub

Private Sub Form_Load () WebBrowser1.naVigate "http://www.applevb.com" end SUB

Private Sub WebBrowser1_CommandStateChange (ByVal Command As Long, ByVal Enable As Boolean) If (Command = CSC_NAVIGATEBACK) Then Command2.Enabled = Enable End If If (Command = CSC_NAVIGATEFORWARD) Then Command1.Enabled = Enable End IfEnd Sub

The above Command1 is the forward button, and the Command2 is the rear button.

转载请注明原文地址:https://www.9cbs.com/read-12061.html

New Post(0)