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
答案 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