是否可以像 WebView 一样在 Windows 窗体中嵌入 Gecko 或 Webkit?
我很想知道是否有 Gecko.NET 这样的东西;)我的意思是,就像我们可以嵌入 WebView 一样,它是任何 Windows 窗体应用程序中 IE7 的“实例”(并告诉它 navigateto(fancy_url);
)。 我喜欢使用 Firefox 或 WebKit。
有人试过这个吗?
更新:请记住,虽然可以使用上述控件嵌入 Gecko,但在使用 Gecko 时仍然无法打印。
2010 年 3 月更新:仍然无法使用 GeckoFX 进行本地打印,但是有几种方法可能就足够了,具体取决于您想要做什么。 请参阅:http://geckofx.org/viewtopic.php?id=796 了解更多信息信息。
2013 年 10 月更新:我不再进行 Windows 开发,因此对此没有兴趣,但似乎可以在这里找到 Gecko 的开发:https://bitbucket.org/geckofx 它似乎最近更新了。 将此留给未来的 Windows 开发人员;)
2017 年 1 月更新:我收到了一封来自一家名为 的公司的电子邮件团队开发。 他们创建了一个名为“DotNetBrowser”的基于 Chromium 的 .NET 浏览器组件,可用于在 Windows 窗体应用程序中显示现代网页。
直接引用电子邮件:
以下是有关该组件的一些详细信息,可能会有所帮助:
- DotNetBrowser 基于 Chromium,因此支持 HTML5、CSS3、JS 和最新的 Web 标准。 该库的底层 Chromium 版本会定期更新。
- 该组件适用于 WPF 以及 Windows 窗体桌面应用程序,并且适用于 C# 和 VB.NET。
- 该库已获得商业许可,但为开源和学术项目提供免费许可。
免责声明: 我没有使用过这个 DotNetBrowser,因为我不再进行 Windows 开发,但如果您正在寻找解决方案,可能值得检查一下。
I'd love to know if there is such a thing as a Gecko.NET ;) I mean, just like we can embed a WebView and that is an "instance" of IE7 inside any Windows Forms application (and tell it to navigateto(fancy_url);
). I'd love to use Firefox or WebKit.
Anybody tried this?
UPDATE: Please bear in mind that although it is possible to embed Gecko using the mentioned controls, it is still impossible to print while using Gecko.
UPDATE March 2010: It’s still not possible to print natively using GeckoFX, however a couple of methods exist that may be enough, depending upon what you’re trying to do.
See: http://geckofx.org/viewtopic.php?id=796 for more information.
UPDATE October 2013: I am no longer doing Windows development so I have no interest in this, but seems like the development of Gecko can be found here: https://bitbucket.org/geckofx and it seems to be recently updated. Leaving this here for future Windows devs ;)
UPDATE January 2017: I have gotten an email from a company called TeamDev. They created a Chromium-based .NET browser component called "DotNetBrowser" which can be used to display modern web pages in Windows Forms applications.
To quote the email directly:
Here are some details about the component, which might be helpful:
- DotNetBrowser is based on Chromium, thus supporting HTML5, CSS3, JS and the latest web standards. The underlying Chromium version of the library is regularly updated.
- The component is suitable for WPF as well as Windows Forms desktop applications, and works both for C# and VB.NET.
- The library is licensed commercially, however free licences are provided for Open Source and academic projects.
Disclaimer: I have not used this DotNetBrowser for I no longer do Windows Development but may be worth checking if you're looking for a solution to this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
更新2016:
BrowseEmAll.Gecko
可以使用的.Net组件将 Firefox 引擎集成到您的 .Net 应用程序中。 它基于 Geckofx,但与当前版本的 Geckofx 不同,它可以与 Firefox 的正常发布版本一起使用。 要使用 Geckofx,您需要自己构建 Firefox。 同样,可以使用商业支持,但组件本身是完全开源的。
(全面披露:我在这家公司工作,所以对我所说的一切持保留态度)
Update 2016:
BrowseEmAll.Gecko
A .Net component which can be used to integrate the Firefox engine into your .Net application. This is based on Geckofx but unlike the current version of Geckofx this will work with a normal release build of Firefox. To use Geckofx you will need to build Firefox yourself. Again commercial support is available but the component itself is fully open source.
(Full disclosure: I work for this company so take everything I say with a grain of salt)
OpenWebKitSharp 是围绕 WebKit 引擎(每晚)的包装器,并且非常先进。 请看这里(OpenWebKitSharp 部分):http://code.google.com/ p/open-webkit-sharp/
OpenWebKitSharp is a wrapper arount the WebKit engine (nightly) and is very advanced. Take a look at here (OpenWebKitSharp section): http://code.google.com/p/open-webkit-sharp/
GeckoFX 不再更新。 另一种选择是 Se7en Soft 的 MozNet XulRunner 包装器。 MozNet 拥有大量 GeckoFX 没有的功能,并且正在积极更新和维护。
GeckoFX is no longer being updated. The alternative is the MozNet XulRunner wrapper by Se7en Soft. MozNet has a ton of features that GeckoFX doesn't and is being actively updated and maintained.
我想向所有希望将 Gecko 嵌入其应用程序的人指出,GeckoFX 项目似乎已被其创建者(Skybound Software)放弃。 MozNET 以前是基于 GeckoFX 的,但它有点“捡起球并跟着它跑”。 它具有打印、打印预览的全部功能,并允许您通过本机 Windows 打印对话框进行所有设置,甚至 - 以及更多。
I'd just like to point out, to all looking to embed Gecko into their applications, that the GeckoFX project appears to have been abandoned by its creators (Skybound Software). MozNET, while previously based on GeckoFX, sorta' picked up the ball and ran with it. It has the full ability to print, do print previews and allows you to set it all up via the native Windows print dialog, even - and a whole lot more.
@Martin:是的,亚当·洛克版本已经过时了。 但这是因为不需要单独的分发。 现在它是与 Mozilla 代码库的其余部分一起构建的。
如果您下载 Prism(即 XulRunner),这将为您提供一个可以根据您的需求进行自定义的基础,其中包括最新版本的控件(在 \Prism\xulrunner 目录中,您将找到 mozctlx.dll) 。
@Greg:实际上,它是一个ActiveX控件。 顺便说一句,所有 ActiveX 控件都是 COM 控件。 ActiveX 是建立在 COM 之上的。
@Martin: Yes, the Adam Locke version is outdated. But that's because a separate distribution is not necessary. It's built with the rest of the Mozilla codebase now.
If you download Prism (ie XulRunner), that will give you a base that you can customize to your needs, and this includes the most recent version of the control (in the \Prism\xulrunner directory, you'll find mozctlx.dll).
@Greg: Actually, it is an ActiveX control. Incidentally, all ActiveX controls are COM controls. ActiveX is built on COM.
截至 2011 年 10 月 30 日,自上一篇文章发布以来,有新的信息需要添加。 具体来说,虽然 Skybound 停止维护其版本,但至少有一个积极维护的、免费的开源分支可用。
我在 BitBucket 使用 Hindle 的 fork,它凭借他的工具解析 XpCom idls 并创建 c# 包装器,快速更新,支持每个新版本的 Firefox/Gecko。
有关其他选择的概述,请参阅这篇文章。
As of October 30, 2011, there is new information to add since the time of the previous posts. Specifically, while Skybound stopped maintaining their version, there is at least one actively maintained, free, open-source fork available.
I'm using Hindle's fork at BitBucket, which, by virtue of his tool which parses XpCom idls and creates c# wrappers, is rapidly updated with support for each new version of Firefox/Gecko.
See this post for an overview of other choices.
此外,如果您发现自己使用 Gtk 而不是 Windows.Forms,可以使用 webkit-sharp 的 tarball 来轻松将 WebView 嵌入到 Gtk# 应用程序中。
Additionally, if you find yourself using Gtk instead of Windows.Forms, there is a tarball of webkit-sharp available that allows for easy embedding of WebViews into Gtk# applications.
我相信“Gecko FX”[1] 就是您所需要的。
引自网站
“””
GeckoFX 是一个用干净、带注释的 C# 编写的 Windows 窗体控件,可将 Mozilla Gecko 浏览器控件嵌入到任何 Windows 窗体应用程序中。 它还包含一个简单的类模型,提供对 HTML 和 CSS DOM 的访问。
"""
1) 我无法发布链接,因为“新用户不允许添加超链接” 在谷歌代码上搜索“geckofx”。
I Belive "Gecko FX"[1] is the thing you need.
To Quote from the web site
"""
GeckoFX is a Windows Forms control written in clean, commented C# that embeds the Mozilla Gecko browser control in any Windows Forms Application. It also contains a simple class model providing access to the HTML and CSS DOM.
"""
1) I can't post a link as "new users aren't allowed to add hyperlinks" Search for "geckofx" on google code.
这当然是可能的。 您需要做的就是注册 Mozilla ActiveX 控件(我相信是 mozctlx.dll),然后您可以将其作为任何 ActiveX 控件拖到表单上。 编程接口与 IE 类似(尽管不相同),在某些情况下甚至可以使用 Microsoft.MSHTML.dll 托管库进行控制。
我相信这是与 Firefox 一起打包的。 如果没有,您也可以从 Mozilla 获取可嵌入位。 只需在 Google 上搜索 Mozilla ActiveX 控件或 Mozilla Embedding C# 即可找到正确的路径。
It certainly is possible. All you need to do is register the Mozilla ActiveX control (mozctlx.dll I believe), and you can drag it onto your form as any ActiveX control. The programming interface is similar (though not identical) to the IE one, and you can even use the Microsoft.MSHTML.dll managed library for control in some cases.
I believe this is packaged with Firefox. If not, you can get just the embeddable bits from Mozilla as well. Just do a Google search for Mozilla ActiveX control or Mozilla Embedding C# and that should take you down the right path.
http://code.google.com/p/geckofx/
这是一个不错的 .NET -Gecko 的包裹版本
http://code.google.com/p/geckofx/
This is a nice .NET-wrapped version of Gecko