Repository navigation
Fix Disabled RichTextBox renders BackColor in padding area but not in client area under NET11 VisualStylesMode - #15164
Sathish-087 wants to merge 7 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15164 +/- ##
=============================================
Coverage 37.84861% 37.84861%
=============================================
Files 246 246
Lines 9789 9789
Branches 1031 1031
=============================================
Hits 3705 3705
Misses 5920 5920
Partials 164 164
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Fixes disabled RichTextBox background inconsistencies under .NET 11 visual styles.
Changes:
- Unifies disabled background-color selection.
- Invalidates modern non-client rendering on enabled-state changes.
- Adds RichTextBox and TextBoxBase regression tests.
| File | Description |
|---|---|
| src/test/unit/System.Windows.Forms/TextBoxBaseTests.cs | Updated as part of this pull request. |
| src/test/unit/System.Windows.Forms/System/Windows/Forms/RichTextBoxTests.cs | Updated as part of this pull request. |
| src/System.Windows.Forms/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs | Updated as part of this pull request. |
| src/System.Windows.Forms/System/Windows/Forms/Controls/RichTextBox/RichTextBox.cs | Updated as part of this pull request. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| control.ResetTrackedMessages(); | ||
| control.Invalidate(); | ||
| control.Update(); | ||
|
|
||
| Assert.True(control.PaintMessageReceived); |
There was a problem hiding this comment.
Updated the regression test to render the control and compare the disabled RichTextBox client and padding background colors directly. I also added a sentinel color check to ensure both regions were rendered, preventing false-positive results.
SimonZhao888
left a comment
There was a problem hiding this comment.
Since the disabled effective background is now synchronized into the native RichEdit through EM_SETBKGNDCOLOR, could we also verify the round-trip Enabled -> Disabled -> Enabled behavior for both the default and an explicitly assigned BackColor?
In particular, I want to make sure the native client area restores the correct enabled background rather than retaining the disabled color. It may also be worth covering a BackColor change while the control is disabled.
Updated the regression test to render the control and compare the disabled RichTextBox client and padding background colors directly. I also added a sentinel color check to ensure both regions were rendered, preventing false-positive results. |

Fixes #15053
Proposed changes
Customer Impact
Regression?
Risk
Screenshots
Before
After
Test methodology
Accessibility testing
Test environment(s)
Microsoft Reviewers: Open in CodeFlow