CefSharp WinForms Web Browser Won't Display

后端 未结 1 1030
独厮守ぢ
独厮守ぢ 2021-01-07 07:11

I have a dead simple example trying to get the CEF Browser to append on a Winforms Form. For some reason it won\'t display.

public partial class Form1 : Form         


        
相关标签:
1条回答
  • 2021-01-07 07:32

    Your code above is a bit too dead simple :)

    It's missing a call to Cef.Initialize()

    See the Main() method of the CefSharp.MinimalExample.WinForms example for a working example and further details on how to use CefSharp.

    You also need to give the control a DockStyle.Fill, like:

    public Form1()
    {
        InitializeComponent();
        var test = new CefSharp.WinForms.ChromiumWebBrowser("http://google.com")
        {
            Dock = DockStyle.Fill,
        };
        this.Controls.Add(test);
    }
    
    0 讨论(0)
提交回复
热议问题