如何在C#中使用Gecko

编程入门 行业动态 更新时间:2024-10-25 08:16:25
本文介绍了如何在C#中使用Gecko的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要一个Gecko WebBrowser控件

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

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

解决方案

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

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

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

  • 将GeckoWebBrowser控件拖到winform设计器中,我们称之为浏览器

  • 在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 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

本文发布于:2023-11-03 06:41:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1554475.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Gecko

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!