diff --git a/src/WinFormedge/Classes.Formedge/FormBase.cs b/src/WinFormedge/Classes.Formedge/FormBase.cs
index 3d907ac..28224a4 100644
--- a/src/WinFormedge/Classes.Formedge/FormBase.cs
+++ b/src/WinFormedge/Classes.Formedge/FormBase.cs
@@ -1,4 +1,4 @@
-// This file is part of the WinFormedge project.
+// This file is part of the WinFormedge project.
// Copyright (c) 2025 Xuanchen Lin all rights reserved.
// This project is licensed under the MIT License.
// See the LICENSE file in the project root for more information.
@@ -384,8 +384,8 @@ protected override void WndProc(ref Message m)
}
break;
- case WM_ERASEBKGND:
- return;
+ //case WM_ERASEBKGND when SystemBackdropType != SystemBackdropType.Auto:
+ // return;
case WM_NCCALCSIZE when wParam == 1 && ExtendsContentIntoTitleBar && !Popup && !Fullscreen:
{
diff --git a/src/WinFormedge/Classes.Formedge/Formedge.Internal.cs b/src/WinFormedge/Classes.Formedge/Formedge.Internal.cs
index c1746ce..2e9348a 100644
--- a/src/WinFormedge/Classes.Formedge/Formedge.Internal.cs
+++ b/src/WinFormedge/Classes.Formedge/Formedge.Internal.cs
@@ -1,4 +1,4 @@
-// This file is part of the WinFormedge project.
+// This file is part of the WinFormedge project.
// Copyright (c) 2025 Xuanchen Lin all rights reserved.
// This project is licensed under the MIT License.
// See the LICENSE file in the project root for more information.
@@ -73,12 +73,14 @@ internal WebViewCore WebView
{
ProfileName = ProfileName,
IsInPrivateMode = IsInPrivateMode,
+
};
- WebView.WebViewCreated += (_, _) => WebViewCreatedCore();
+ WebView.WebViewCreated += (_, _) => WebViewCreatedCore(WindowStyleSettings);
WindowStyleSettings.WndProc += WebView.HostWndProc;
+
}
return _webViewCore;
@@ -804,7 +806,7 @@ private void RegisterHostWindowEvents()
///
/// Called when the WebView2 browser is created. Sets up host objects, scripts, and event handlers.
///
- private void WebViewCreatedCore()
+ private void WebViewCreatedCore(WindowSettings windowStyleSettings)
{
if (WebView.Browser == null) throw new InvalidOperationException();
@@ -813,10 +815,9 @@ private void WebViewCreatedCore()
var controller = WebView.Controller;
var webview = WebView.Browser;
- controller.DefaultBackgroundColor = Color.Transparent;
+ controller.DefaultBackgroundColor = windowStyleSettings.BackColor;
WebView.ConfigureSettings += ConfigureWebView2Settings;
- //WebView.ConfigureProfile += ConfigureWebView2Profile;
controller.GotFocus += OnGotFocus;
controller.LostFocus += OnLostFocus;
diff --git a/src/WinFormedge/Classes.WebView/WebViewCore.cs b/src/WinFormedge/Classes.WebView/WebViewCore.cs
index bc77ab1..87aac6d 100644
--- a/src/WinFormedge/Classes.WebView/WebViewCore.cs
+++ b/src/WinFormedge/Classes.WebView/WebViewCore.cs
@@ -1,4 +1,4 @@
-// This file is part of the WinFormedge project.
+// This file is part of the WinFormedge project.
// Copyright (c) 2025 Xuanchen Lin all rights reserved.
// This project is licensed under the MIT License.
// See the LICENSE file in the project root for more information.
@@ -249,7 +249,7 @@ private async Task CreateWebView2Async()
controller.ShouldDetectMonitorScaleChanges = true;
controller.Bounds = Container.ClientRectangle;
- controller.DefaultBackgroundColor = Color.Transparent;
+ controller.DefaultBackgroundColor = Container.BackColor; //Color.Transparent;
var webview = controller!.CoreWebView2;
diff --git a/src/WinFormedge/WinFormedge.csproj b/src/WinFormedge/WinFormedge.csproj
index 117d4cb..fb0418d 100644
--- a/src/WinFormedge/WinFormedge.csproj
+++ b/src/WinFormedge/WinFormedge.csproj
@@ -60,7 +60,7 @@
- 1.1.2
+ 1.1.3
True