VB.NET Awesomium在新窗口中打开target_blank示例

时间:2015-06-21 22:55:13

标签: awesomium

好吧我尝试了搜索谷歌的所有内容,尝试了文档Awesomium中的示例,但它没有用。我有一个标签式浏览器。我如何使每个webcontrol处理showcreatedwebview事件。

1 个答案:

答案 0 :(得分:-1)

这是您创建的窗口

 Private Sub Mainwindow_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        PictureBox2.Enabled = False
        TextBox1.Text = Clipboard.GetText
        WebControl1.Source = New Uri(TextBox1.Text)
    End Sub

这适用于您的浏览器

 Private Sub WebControl1_ShowCreatedWebView(ByVal sender As Object, ByVal e As Awesomium.Core.ShowCreatedWebViewEventArgs) Handles WebControl1.ShowCreatedWebView
        Clipboard.SetText(e.TargetURL.ToString)
        Dim webControl As Awesomium.Windows.Forms.WebControl = TryCast(sender, Awesomium.Windows.Forms.WebControl)
        Form1.Tabcontrol1.TabContainer.AddTab(New Mainwindow, True, Form1.Tabcontrol1.TabContainer.TabCount)
        Dim webControl11 As WebControl = TryCast(sender, WebControl)
        If webControl Is Nothing Then Return
        If Not webControl.IsLive Then Return
        Mainwindow.Close()
        If e.IsPopup AndAlso (Not e.IsUserSpecsOnly) Then
            ' JSWindowOpenSpecs.InitialPosition indicates screen coordinates
        ElseIf (e.IsWindowOpen OrElse e.IsPost) Then
        Else
            e.Cancel = True
            Mainwindow.TextBox1.Text = e.TargetURL.ToString
            ' Show the window.
            Form1.Tabcontrol1.TabContainer.AddTab(New Mainwindow, True, Form1.Tabcontrol1.TabContainer.TabCount)
            End If
    End Sub
End Class