在VB.NET项目中使用GeckoWebBrowser(v45.0.34.0)

Sim*_*eek 2 vb.net gecko geckofx

我试图使GeckoWebBrowser(版本45.0.34.0)控件能够正常运行到我的VB.NET项目中!!!!

这是我遵循的步骤...

1.我确实右键单击项目进入“ 解决方案资源管理器”列表,然后单击“管理NuGet软件包”

2.我找到并安装了 Geckofx45。

3.然后进入项目的属性,进入“ 编译”选项卡,然后将“ 目标CPU”更改为x86

4.重建我的项目。

5.然后,通过从文件夹中选择Geckofx-Winforms.dll文件,将GeckoWebBrowser控件添加到我的工具箱中...\packages\Geckofx45.45.0.34\lib\net45

6.我在表单中添加了一个GeckoWebBrowser控件,并且为了测试,我在表单的事件中添加了控件。GeckoWebBrowser1.Navigate("www.google.com")Load

7.启动我的应用程序,却一无所获!!!

我错过了任何一步或什么?

Sim*_*eek 5

经过互联网上的精疲力尽(!!!)研究之后,我设法使其工作了!!!这是想要将GeckoWebBrowser用于其VB.NET项目的任何人的步骤。

1.创建一个新的VB.NET项目或仅打开一个现有的项目。

2.转到菜单项目,然后单击管理NuGet软件包

3.单击浏览选项卡,然后搜索Geckofx45

4.选择一个带有说明的库:允许将壁虎嵌入C#应用程序的库,然后单击“ 安装”按钮。

5.关闭NuGet窗口,然后转到项目的Properties

6.进入应用程序选项卡中单击查看应用程序事件按钮。

7.删除其中的所有内容,并将这部分代码粘贴并保存。

Imports Gecko
Imports System.IO
Namespace My
    ' The following events are available for MyApplication:
    '
    ' Startup: Raised when the application starts, before the startup form is created.
    ' Shutdown: Raised after all application forms are closed.  This event is not raised if the application terminates abnormally.
    ' UnhandledException: Raised if the application encounters an unhandled exception.
    ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
    ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
    Partial Friend Class MyApplication
        Protected Overrides Function OnStartup(ByVal eventArgs As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) As Boolean
            Dim ProfileDirectory As String = My.Application.Info.DirectoryPath & "\Firefox\Profile"
            If Not Directory.Exists(ProfileDirectory) Then
                Directory.CreateDirectory(ProfileDirectory)
            End If
            Xpcom.ProfileDirectory = ProfileDirectory
            Gecko.Xpcom.Initialize("Firefox")
            Return True
        End Function
    End Class
End Namespace
Run Code Online (Sandbox Code Playgroud)

8.现在,返回项目属性,单击“ 编译”选项卡,然后将“ 目标CPU”值设置为x86

9.生成或重建项目。

10a。要将GeckoWebBrowser控件添加到工具箱中,请先创建一个新标签,然后将其命名为GeckoFX 45或您喜欢的任何名称。

10b。右键单击它,然后单击选择项目

10b。进入.NET Framework组件,然后单击“ 浏览”按钮。

10分。查找Geckofx-Winforms.dllyour-project-folder\packages\Geckofx45.45.0.34\lib\net45\,然后单击打开按钮。

10天 确保GeckoWebBrowser已选中该复选框,然后单击“ 确定”