Quick Start for WinForms

In this article, you will learn how to download the DotNetBrowser library, get an evaluation license, and create, configure and run your first .NET WinForms application which loads and displays the DotNetBrowser Home Page.

Windows 10, Microsoft Visual Studio 2017, .NET Framework 4.6.

The sample solution which demonstrates how to embed lightweight or heavyweight controls into WinForms applications can be downloaded here. The projects in this solution have NuGet dependencies which will be resolved automatically during build.

1. Download the library

To download DotNetBrowser library, navigate to http://www.teamdev.com/dotnetbrowser and click the Download button. Extract the downloaded dotnetbrowser-2.x.zip archive into the D:\Projects\DotNetBrowser\ directory.

2. Download the license

To get a free 30-day evaluation license, fill the web form and click the GET EVALUATION button. You will receive an email with a link. Use this link to download your evaluation license which is dotnetbrowser.license file. Save the license file in the D:\Projects\DotNetBrowser\Library\ directory.

3. Create a Windows Forms application

Create a new WinForms.DotNetBrowser WinForms Application C# Project or WinForms Application Visual Basic Project in the D:\Projects\DotNetBrowser directory:

WPF Project

4. Add DotNetBrowser DLL assemblies

In the Solution Explorer, right-click References and select the Add References… menu item:

Add Reference

In the Reference Manager which opens, click the Browse button:

Browse Button

Select the DotNetBrowser.dll, DotNetBrowser.Core.dll, DotNetBrowser.Logging.dll, DotNetBrowser.WinForms.dll files and click Add:

Select Files

Double-check all selected references are added and appear in the Reference Manager dialog and click OK:

Confirm Reference

DotNetBrowser.ChromiumXX.dll is found automatically if it is located in the same folder as DotNetBrowser.dll. You can also add it to your references, especially if you deploy your project using Microsoft Visual Studio. Both assemblies are required.

5. Add a license

In Solution Explorer, right-click WinForms.DotNetBrowser, select Add > Existing Item and upload dotnetbrowser.license file you downloaded earlier. It appears at the bottom of the Solution Explorer:

Add License

Right-click dotnetbrowser.license and select Properties:

License Properties

In the Properties panel which opens, select Embedded Resource as Build Action:

Embedded Resource

To embed the license key into your project programmatically, open dotnetbrowser.license file with any text editor, such as Notepad, copy its content, and insert a key string as shown below:

IEngine engine = EngineFactory.Create(
        new EngineOptions.Builder
            LicenseKey = "your_licese_key"

For more information on licensing, refer to this article.

6. Change the source code

Insert the following code into the Form1.cs file:

using DotNetBrowser.Browser;
using DotNetBrowser.Engine;
using DotNetBrowser.WinForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinForms.Sample
    public partial class Form1 : Form
        BrowserView webView;

        private IBrowser browser;
        private IEngine engine;

        public Form1()
            webView = new BrowserView() { Dock = DockStyle.Fill };
            Task.Run(() =>
                engine = EngineFactory.Create(new EngineOptions.Builder 
                    RenderingMode = RenderingMode.HardwareAccelerated 
                browser = engine.CreateBrowser();
            .ContinueWith(t =>
            }, TaskScheduler.FromCurrentSynchronizationContext());
            FormClosing += Form1_FormClosing;

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)

7. Run the application

To run the application, press F5 or click the Start button on the toolbar. The Form1 window opens:

Application Launch

Go Top