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:
Browser browser = BrowserFactory.Create();
To create a new Browser instance with specified rendering mode use the following approach:
// 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);
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:
|Description||In 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.
|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.
|Limitations||Using 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.