使用C#将Internet Explorer浏览器嵌入Winforms [英] Embed Internet Explorer browser into Winforms using C#

查看:228
本文介绍了使用C#将Internet Explorer浏览器嵌入Winforms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用IE打开IP指定的网页(为什么IE?因为不是每个Windows都安装了Chrome或Firefox)并将其显示在一个简单的Winforms窗口中。

I'm trying to open a IP specified webpage using IE (Why IE? Because not every Windows have Chrome or Firefox installed) and present it in a simple Winforms window.

上面提到的网页是一个BI(商业智能)网页,它将动态更新自己,我希望用户在页面更新时坐下来查看它有一个新的统计数据。

The up-mentioned webpage is a BI (Business Intelligence) webpage that will update itself dynamically, and I want the user to sit and look at it while the page is updated with a new statistics.

事件流程:


  • 用户将输入特定的IP地址,然后单击获取网页。

  • User will enter the specific IP address and click "Get the Web-page".

新的Winform窗口会弹出特定的网页。

New Winform window will pop-up with the specific webpage inside.

此外,如果有隐藏IE导航面板的选项会很棒,因为我不想在这个窗口中提供浏览选项。

Also, it will be great if there an option to hide IE navigation panel, because I don't want to give the option of browsing in this window.

我尝试使用CefSharp做到这一点,但我没有到达任何地方。我看到的每个例子都是用asp编写的。

I tried to do this using CefSharp, but I didn't get to anywhere. Every example that I saw was written in asp.

这是我到目前为止所做的,但这不起作用:

Here is was I did so far, and this is not working:

namespace BingoDesktopWindow
{
    public partial class BingoWin : Form
    {
        public BingoWin()
        {
            InitializeComponent();

            CefSettings settings = new CefSettings();
            CefSharp.Cef.Initialize(settings);

            ChromiumWebBrowser browser = new ChromiumWebBrowser("http://12.345.67.89/bingo/Default.html");
            this.browserPanel.Container.Add(browser);
        }
    }

谢谢!
}

Thank you! }

推荐答案

为什么不使用Winforms WebBrowser控件。 WinForms WebBrowserControl 。你可以比IE更多地操纵它。 Web浏览器控件本身是从IE派生的,所以它具有所有功能。

Why do not you use Winforms WebBrowser control. WinForms WebBrowserControl. You can manipulate it more than IE. Web browser control is itself derived from IE so, it has all its functionalities.

这篇关于使用C#将Internet Explorer浏览器嵌入Winforms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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