C# 中的 Gecko 用法 (geckofx)

发布于 2024-08-14 03:41:41 字数 189 浏览 4 评论 0原文

我没有找到如何使用 geckofx 执行以下操作:

  1. 获取单击的链接的 URL。

  2. 显示打印预览窗口。

geckofx 中有这个功能吗?如果没有,最好的方法是什么 在使用GeckoWebBrowser显示html页面的C#项目中实现它?

谢谢

There are some things that I didn't find how to do using geckofx:

  1. Get the URL of a clicked link.

  2. Display print preview window.

Does this functionality exist in geckofx? If not, what's the best way
to achieve it in a C# project that uses GeckoWebBrowser to display html pages?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

岁月蹉跎了容颜 2024-08-21 03:41:41

要获取单击链接的 url,您可以使用:

    void domClicked(object sender, GeckoDomMouseEventArgs e)
    {
     if(geckoWebBrowser1.StatusText.StartsWith("http"))
     {
      MessageBox.Show(geckoWebBrowser1.StatusText);//forward status text string somewhere
     }
    }

要显示打印对话框,您可以使用:

    geckoWebBrowser1.Navigate("javascript:print()");

To get url of clicked link you can use:

    void domClicked(object sender, GeckoDomMouseEventArgs e)
    {
     if(geckoWebBrowser1.StatusText.StartsWith("http"))
     {
      MessageBox.Show(geckoWebBrowser1.StatusText);//forward status text string somewhere
     }
    }

To show print dialog box you can use:

    geckoWebBrowser1.Navigate("javascript:print()");
蓝颜夕 2024-08-21 03:41:41

OnNaviagted 事件应该为您提供链接,并在 Geckofx 中查找打印接口 nsIPrintingPromptService::ShowPrintDialog

OnNaviagted event should give you the link, and look for the print interfaces nsIPrintingPromptService::ShowPrintDialog in Geckofx.

情未る 2024-08-21 03:41:41
geckoWebBrowser.url

这将在我相信 geckoWebBrowser 是控件名称的任何地方为您提供 url,但是正如所指出的,您将能够使用 e.url 从文档完成和导航事件中获取它。

geckoWebBrowser.url

That will give you the url at any point I believe where geckoWebBrowser is the name of the control, however as pointed out you'll be able to get it from the document completed and navigated events using e.url .

剧终人散尽 2024-08-21 03:41:41

如需打印,请参阅此论坛帖子。 请务必阅读全部内容在开始之前。本质上,您必须修补并重新编译 GeckoFX。

For printing, see this forum thread. Make sure to read it all before starting. Essentially you'll have to patch and recompile GeckoFX.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文