使用awesomium在windows窗体中实现浏览器

时间:2012-02-23 12:34:51

标签: c# .net winforms awesomium

我正在使用Awesomium尝试在我的Windows窗体应用程序中实现网页。

我已经使用了awesomium .NET示例,但我只是没有得到我的标签与我的homeurl。

当我运行我的项目时,状态栏浮动在我的表单中,没有其他任何事情发生。

任何人都知道我在哪里可以做到这一点或者知道可能出现什么问题?

    public Laboratory() {
        WebCoreConfig webConfig = new WebCoreConfig() {
            SaveCacheAndCookies = true,
            HomeURL = "http://www.google.com",
            LogLevel = LogLevel.Verbose
        };

        // Using our executable as a child rendering process, is not
        // available when debugging in VS.
        if (!Process.GetCurrentProcess().ProcessName.EndsWith("vshost")) {
            // We demonstrate using our own executable as child rendering process.
            // Also see the entry point (Main function) in Program.cs.
            webConfig.ChildProcessPath = WebCoreConfig.CHILD_PROCESS_SELF;
        }
        WebCore.Initialize(webConfig);

        InitializeComponent();
    }

    #region methodes

    #region OpenTab
    internal WebDocument OpenTab(string url = null, string title = null) {
        WebDocument doc = String.IsNullOrEmpty(url) ? new WebDocument() :
            String.IsNullOrEmpty(title) ? new WebDocument(url) : new WebDocument(url, title);
        doc.Show(dockPanel);

        return doc;
    }
    #endregion

    protected override void OnLoad(EventArgs e) {
        base.OnLoad(e);
        this.OpenTab();
    }

Windows form application

2 个答案:

答案 0 :(得分:0)

我完全重做了左侧面板并使用了下载的另一个示例,它就像一个魅力。这是非常基本的,但现在也可以。

答案 1 :(得分:0)

我也有同样的问题,但我设计了解决问题的方法。我实现了需要在每个选项卡上呈现的主浏览器引擎(根据示例的WebDocument页面)作为用户控件。然后我在mainForm中使用了DockPannel。

所以我创建了一个用户控件的实例,然后将其添加到DockPannel的一个实例中,从而创建一个具有所需结构的选项卡。

如果您仍未找到解决方案或遇到问题,请留下评论,我会提供一些代码来帮助您。