U
U
Uncle Bogdan2021-04-15 19:06:38
C++ / C#
Uncle Bogdan, 2021-04-15 19:06:38

How to launch the browser in a separate CefSharp window?

It was created behind the elements, but how do you launch the browser in a separate window?
Code now:

namespace WinFormsApp7
    {
    public partial class Form1 : Form
    {
        private ChromiumWebBrowser ChromeBrowser;
        public Form1()
        {
            InitializeComponent();
            InitializeChromium();
        }
private void InitializeChromium()
        {
            CefSettings Settings = new CefSettings();
            Cef.Initialize(Settings);
            ChromeBrowser = new ChromiumWebBrowser("https://kad.arbitr.ru/");
            this.Controls.Add(ChromeBrowser);
            ChromeBrowser.Dock = DockStyle.Fill;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            Cef.Shutdown();
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BasiC2k, 2021-04-15
@BasiC2k

It is better to place ChromeBrowser not on the form, but on the panel.
In this case,
this.Panel1.Controls.Add(ChromeBrowser);
and the panel can already be placed at the desired visibility level (behind / in front of other elements)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question