问个简单的问题,怎么做到在form1的webbrowser里点击一下,就能hide form1 接着show form2
3个回答
展开全部
webbrowser控件没有Click事件,用timer监测webbrowser,一个简单的例子参考一下:
Private Sub Form_Activate()
Timer1.Enabled = True
End Sub
Private Sub Form_Deactivate()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 100
WebBrowser1.Navigate "about:blank"
WebBrowser1.Document.write "<body onclick=""vbscript:aaa.value=1""><input type=hidden id=aaa>"
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Set obj = WebBrowser1.Document.getelementbyid("aaa")
If obj.Value <> "1" Then Exit Sub
obj.Value = ""
Me.Hide
Form2.Show
End Sub
Private Sub Form_Activate()
Timer1.Enabled = True
End Sub
Private Sub Form_Deactivate()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 100
WebBrowser1.Navigate "about:blank"
WebBrowser1.Document.write "<body onclick=""vbscript:aaa.value=1""><input type=hidden id=aaa>"
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Set obj = WebBrowser1.Document.getelementbyid("aaa")
If obj.Value <> "1" Then Exit Sub
obj.Value = ""
Me.Hide
Form2.Show
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询