2

我在看这个网站:https ://bitbucket.org/geckofx/geckofx-14.0

我对 GeckOFX 一无所知,因此下载 zip 文件时我参考了 Geckofx-core-14 和 Geckofx-WinForms-14。

我用这个代码...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Gecko;
using GeckoFX;

namespace GeckoFXTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            //Gecko.Xpcom.Initialize("C:\\tools\\xulrunner");
            GeckoWebBrowser myBrowser = new GeckoWebBrowser();
            this.Controls.Add(myBrowser);
            myBrowser.Dock = DockStyle.Fill;

            myBrowser.Navigate("http://www.google.com");
        }
    }
}

但我想我错过了一些东西,有人可以告诉我我错过了什么吗?或者如何开始,我找不到 GeckOFX 14 的扩展坞

使用 C# WinForms 4.0 .Net 提前致谢。

4

2 回答 2

3

您注释掉的行很重要:

//Gecko.Xpcom.Initialize("C:\\tools\\xulrunner");

在创建 GeckoWebBrowser 控件之前,您需要通过调用 Gecko.Xpcom.Initialze 下载 xulrunner 14 或 firefox 14 并告诉 geckofx 在哪里可以找到它。

此外,您只需为每个应用程序调用一次 Xpcom.Initialize,因此您不想将其放入表单构造函数中。

于 2012-09-13T01:30:53.953 回答
0

您可以下载 xulrunner-sdk https://bitbucket.org/geckofx/geckofx-33.0/downloads

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Gecko;
    using Gecko.DOM;
    using System.Net.Mail;
    using System.Net.Mime;
    using System.IO;
    public partial class Form1 : Form
    {
    public Form1()
            {
                InitializeComponent();

                Gecko.Xpcom.Initialize(@"F:\bak\Desktop\frefox c sharp\xulrunner-33.1.1.en-US.win32.sdk\xulrunner-sdk\bin");

            }
    private void button4_Click(object sender, EventArgs e)
            {

                geckoWebBrowser1.Navigate("http://example.com");


            }
}
于 2015-09-24T10:06:19.100 回答