如何在C#中使用Gecko [英] How to use Gecko in C#

查看:590
本文介绍了如何在C#中使用Gecko的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个Gecko WebBrowser控件



我需要一个示例代码或一个说明如何使用GECKO的链接



如果有人使用过Gecko,我可以提出一些建议

解决方案

可以找到带有详细快照的原始教程




  • 添加对dll的引用,如上所示,单击浏览并选择Geckofx-Core.dll和Geckofx-Winforms.dll







  • 在工具箱中,右键单击,然后选择选择项目,选择Geckofx-Winforms.dll,然后将显示Gecko winform控件。在工具箱中







  • 将GeckoWebBrowser控件拖到winform设计器中,我们称之为浏览器
    < a href = https://i.stack.imgur.com/uozf1.png rel = nofollow noreferrer>


  • 在form1.cs文件中,添加以下代码:




行Gecko.Xpcom.Initialize(@ .. \xulrunner) ;指定xulrunner运行时所在的位置。在这种情况下,我们将其放入文件夹(@ .. \xulrunner)。



现在运行应用程序,是的~~~




I need a Gecko WebBrowser Control

I need a sample code or a link which explains how to use GECKO

If anyone has used Gecko, I could do with some advice

解决方案

Original tutorial with detailed snapshots can be found here.

A most recent update can be found here. Please upvote in that article if you find it useful :)

To embed Gecko browser in your winform application, you need:

  • XulRunner: XULRunner is a Mozilla runtime package that can be used to bootstrap XUL+XPCOM applications that are as rich as Firefox and Thunderbird. It provides mechanisms for installing, upgrading, and uninstalling these applications. XULRunner can be downloaded here. Choose the version you like.
  • GeckoFx .net assembly file, which you can download from here. Also choose the correct version which matches the XulRunner version.

  • Unpack the GeckoFX-330.zip, you will get below files:

  • Add references to the dlls as shown above, click browse and select the Geckofx-Core.dll and Geckofx-Winforms.dll

  • In the toolbox, right click, and then select "Choose Item", select Geckofx-Winforms.dll, and the Gecko winform control will be shown in the toolbox

  • Drag a GeckoWebBrowser control to the winform designer, and let’s call it "browser"

  • In the form1.cs file, add below code:

The line Gecko.Xpcom.Initialize(@"..\xulrunner"); specifies where the xulrunner runtime is located. In this case, we put it into a folder (@"..\xulrunner").

Now run the application, yeah~~~

这篇关于如何在C#中使用Gecko的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆