DotNetBrowser supports two rendering modes: lightweight and heavyweight. By default, heavyweight rendering mode is enabled, so when you create Browser instance using the following code, it creates a new Browser instance configured to use heavyweight rendering mode:

C#

Browser browser = BrowserFactory.Create();

VB.NET

Dim browser As Browser = BrowserFactory.Create()


To create a new Browser instance with specified rendering mode use the following approach:

C#

// Creates Browser instance with enabled lighweight rendering mode
Browser browser = BrowserFactory.Create(BrowserType.LIGHTWEIGHT);

// Creates Browser instance with enabled heavyweight rendering mode
Browser browser = BrowserFactory.Create(BrowserType.HEAVYWEIGHT);

VB.NET

' Creates Browser instance with enabled lighweight rendering mode
Dim browser As Browser = BrowserFactory.Create(BrowserType.LIGHTWEIGHT)

' Creates Browser instance with enabled heavyweight rendering mode
Dim browser As Browser = BrowserFactory.Create(BrowserType.HEAVYWEIGHT)


The library provides a BrowserType designer property for the BrowserView controls. This property can be used to switch between modes in the designer.


The differences between lightweight and heavyweight rendering modes and recommendations about what rendering mode you should use in your application are listed below:



Lightweight (off-screen)
Heavyweight (GPU-accelerated)  
DescriptionIn the lightweight rendering mode Chromium engine renders web page off-screen using CPU. An image of the web page is saved in shared memory. DotNetBrowser reads the image from the shared memory and  displays it using standard WPF or WinForms API.
In the heavyweight rendering mode, which is default mode in DotNetBrowser, we embed a native Win32 window into your .NET application frame. Then, the Chromium engine is configured to render content into this native window using GPU.
When should
be used
This rendering mode works great if you need a regular WPF/WinForms control that allows displaying modern HTML5/JavaScript/CSS web pages. The behavior of the lightweight control is more natural.
You can:
  • make this control transparent, 
  • display other controls on top of it (lightweight mode respects Z-order of the components.), 
  • render something over web page,
  • overcome airspaces issue in WPF.  
Heavyweight (GPU-accelerated) rendering mode works much faster compared to the lightweight mode. In this mode the rendering performance is the same as in Google Chrome.
You can:
  • display full-screen video,
  • display HTML5 dynamic animation with 60fps,
  • provide touch and gesture events support on the web page.

LimitationsUsing the lightweight mode will lead to higher CPU load and memory  usage — additional resources will be used for rendering without GPU. In  addition, the rendering will be a bit slower — you will notice this when playing full screen video or displaying HTML5 dynamic animation. There are also some known issues related to recognizing touch events and drag-and-drop support.
In the heavyweight mode Chromium engine draws the image directly on the Win32 window using GPU. This native window is configured as a child window and it covers all underlying controls. As a result, heavyweight mode does not respect Z-order, does not support WPF Transform and WPF AllowsTransparency.

Also, we don't recommend that you use this rendering mode in multi document applications because of possible Z-order and offset issues.