从另一种形式打电话给昏暗

时间:2018-03-27 07:28:37

标签: vb.net cefsharp

Hello iam尝试从我的主窗体调用浏览器,但是当我输入FrmWebBrowser.browser时它不可见。

这是来自FrmWebBrowser的代码。

Imports CefSharp
Imports CefSharp.WinForms
Public Class FrmWebBrowser
    Public Sub FrmWebBrowser_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim settings As New CefSettings()
        Dim browser = New ChromiumWebBrowser("http://google.com/") With {
            .Dock = DockStyle.Fill
        }
        Me.Controls.Add(browser)
    End Sub
End Class

1 个答案:

答案 0 :(得分:0)

只需在表单开头声明browser即可。

dim browser as ChromiumWebBrowser
Public Sub FrmWebBrowser_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim settings As New CefSettings()
    browser = New ChromiumWebBrowser("http://google.com/") With {
        .Dock = DockStyle.Fill
    }
    Me.Controls.Add(browser)
End Sub