GeckoFX的例子

时间:2013-01-29 02:59:31

标签: vb.net xulrunner geckofx

我下载了GepinoFX(版本16),XULRunner Dotnet包装器,用于winForms(VB.NET)应用程序,但没有任何使用说明(只是初始化命令)。

我将控件添加到我的表单和Form加载事件中,输入以下内容:

Private Sub Form1_Load(sender As System.Object,e As System.EventArgs)处理MyBase.Load

    Xpcom.Initialize(My.Application.Info.DirectoryPath & "/xulrunner")
    InitializeComponent()

    Me.GeckoWebBrowser1.Enabled = True
    Me.GeckoWebBrowser1.Navigate("http://www.google.com")

End Sub

什么都没发生。控件不可见,不进行导航。 只是一个简单的项目(C#也很好),它显示控件实际工作会很好(请不要回答另一个指向GeckoFx维基页面的URL,因为它没用,并且没有显示任何示例)

2 个答案:

答案 0 :(得分:1)

Imports Gecko

Public Class Form1

Private myBrowser As GeckoWebBrowser

Public Sub New()
    InitializeComponent()
    Xpcom.Initialize(My.Application.Info.DirectoryPath & "\xulrunner")
    myBrowser = New GeckoWebBrowser()
    myBrowser.Parent = Me.SplitContainer1.Panel2
    myBrowser.Dock = DockStyle.Fill
End Sub

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    myBrowser.Navigate(TextBox1.Text)
End Sub

End Class

答案 1 :(得分:1)

只需使用活动即可。我正在为withEvents说话:D     进口壁虎

Public Class Form1

Private WithEvents myBrowser As GeckoWebBrowser

Public Sub New()
InitializeComponent()
Xpcom.Initialize(My.Application.Info.DirectoryPath & "\xulrunner")
myBrowser = New GeckoWebBrowser()
myBrowser.Parent = Me.SplitContainer1.Panel2
myBrowser.Dock = DockStyle.Fill
End Sub

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
myBrowser.Navigate(TextBox1.Text)
End Sub

End Class