How to use Gecko in C#

空扰寡人 提交于 2019-11-29 08:32:20

问题


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


回答1:


Original tutorial with detailed snapshots can be found here.

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~~~




回答2:


You should check out http://code.google.com/p/geckofx/. To get some code samples see the Wiki page.



来源:https://stackoverflow.com/questions/8778320/how-to-use-gecko-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!