VB.NET Awesomium open in new window target_blank Example

571 views Asked by At

Okay i tried everything searched google, tried the example in docs Awesomium and it didn't work. I have a tabbed browser. How can i make for every webcontrol to handle showcreatedwebview event.

1

There are 1 answers

0
Mfdl Altyb On

this for window you created

 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

this for you browser

 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