解决一个背景色错误的bug - #59
Merged
Merged
Conversation
There was a problem hiding this comment.
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
解决一个背景色错误的bug