Skip to content

解决一个背景色错误的bug - #59

Merged
XuanchenLin merged 1 commit into
masterfrom
dev
Aug 13, 2026
Merged

XuanchenLin merged 1 commit into
masterfrom
dev

Conversation

@XuanchenLin

Copy link
Copy Markdown
Owner

解决一个背景色错误的bug

Copilot AI lite review requested due to automatic review settings August 13, 2026 17:06
@XuanchenLin
XuanchenLin merged commit 529b9c8 into master Aug 13, 2026
1 check passed
@XuanchenLin
XuanchenLin deleted the dev branch August 13, 2026 17:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 旨在修复 WebView2 宿主窗口/控件在某些场景下出现的背景色显示错误,通过调整 WebView2 Controller 的默认背景色设置来与宿主背景保持一致,并同步提升包版本号以发布修复。

Changes:

  • 将 WebView2 DefaultBackgroundColor 从透明改为使用宿主的背景色(Formedge 场景使用 WindowSettings.BackColor,通用 WebViewCore 场景使用 Container.BackColor)。
  • 调整 Form 消息处理中的 WM_ERASEBKGND 逻辑(当前改为注释掉原分支)。
  • NuGet 包版本从 1.1.2 升级到 1.1.3

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/WinFormedge/WinFormedge.csproj 发布修复版本(Version bump 到 1.1.3)。
src/WinFormedge/Classes.WebView/WebViewCore.cs WebView2 Controller 默认背景色改为跟随容器背景色。
src/WinFormedge/Classes.Formedge/Formedge.Internal.cs WebView2 创建完成时将默认背景色改为跟随窗口设置背景色。
src/WinFormedge/Classes.Formedge/FormBase.cs 调整/注释 WM_ERASEBKGND 分支,影响背景擦除行为。

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

controller.ShouldDetectMonitorScaleChanges = true;
controller.Bounds = Container.ClientRectangle;
controller.DefaultBackgroundColor = Color.Transparent;
controller.DefaultBackgroundColor = Container.BackColor; //Color.Transparent;
Comment on lines 816 to 819
var webview = WebView.Browser;

controller.DefaultBackgroundColor = Color.Transparent;
controller.DefaultBackgroundColor = windowStyleSettings.BackColor;

Comment on lines +387 to +388
//case WM_ERASEBKGND when SystemBackdropType != SystemBackdropType.Auto:
// return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants