diff --git a/WebViewControl/GlobalSettings.cs b/WebViewControl/GlobalSettings.cs index 1482b352..9ddd6e70 100644 --- a/WebViewControl/GlobalSettings.cs +++ b/WebViewControl/GlobalSettings.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.IO; using Xilium.CefGlue.Common; @@ -7,6 +8,7 @@ namespace WebViewControl { public class GlobalSettings { + private Color backgroundColor = Color.White; private bool persistCache; private bool enableErrorLogOnly; private bool osrEnabled = false; @@ -25,6 +27,14 @@ public void AddCommandLineSwitch(string key, string value) { public IEnumerable> CommandLineSwitches => commandLineSwitches; + public Color BackgroundColor { + get => backgroundColor; + set { + EnsureNotLoaded(nameof(BackgroundColor)); + backgroundColor = value; + } + } + public string CachePath { get => cachePath; set { diff --git a/WebViewControl/WebViewLoader.cs b/WebViewControl/WebViewLoader.cs index 0b2feed7..4a598701 100644 --- a/WebViewControl/WebViewLoader.cs +++ b/WebViewControl/WebViewLoader.cs @@ -37,7 +37,8 @@ public static void Initialize(GlobalSettings settings) { CachePath = settings.CachePath, // enable cache for external resources to speedup loading WindowlessRenderingEnabled = settings.OsrEnabled, RemoteDebuggingPort = settings.GetRemoteDebuggingPort(), - UserAgent = settings.UserAgent + UserAgent = settings.UserAgent, + BackgroundColor = new CefColor((uint)settings.BackgroundColor.ToArgb()) }; var customSchemes = CustomSchemes.Select(s => new CustomScheme() {