Fix editable control border color in NET11 visual styles - #14853
Draft
LeafShi1 wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a VisualStylesMode.Net11 rendering issue where changing ForeColor on editable controls unintentionally changes the control border color. It centralizes “editable text control” border-color selection in ModernControlColorMath and updates the NET11 renderers for TextBoxBase, ComboBox, and UpDownBase to use this shared logic (including a dark-mode-specific border color).
Changes:
- Added shared editable-control border color selection and enabled/disabled handling in
ModernControlColorMath. - Updated
TextBoxBaseandUpDownBasemodern border rendering to use the shared border color instead ofForeColor. - Updated
ComboBox.ModernComboAdapterborder rendering to use the shared border color (and simplified border-color selection logic).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/System.Windows.Forms/System/Windows/Forms/Rendering/ModernControlColorMath.cs | Introduces shared border color defaults and an enabled/disabled border color helper. |
| src/System.Windows.Forms/System/Windows/Forms/Controls/UpDown/UpDownBase.cs | Uses shared border color logic for NET11 modern border rendering instead of ForeColor. |
| src/System.Windows.Forms/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs | Uses shared border color logic for NET11 non-client painting instead of ForeColor. |
| src/System.Windows.Forms/System/Windows/Forms/Controls/ComboBox/ComboBox.ModernComboAdapter.cs | Switches modern ComboBox border rendering to shared border color logic and simplifies the helper signature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+20
to
+23
| internal static Color TextControlBorderColor | ||
| => Application.IsDarkModeEnabled | ||
| ? s_darkModeTextControlBorder | ||
| : SystemColors.ControlDarkDark; |
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.
Fixes #14847
Proposed changes
Introduce shared editable-control border color logic in
ModernControlColorMathand use it across NET11 editable renderers.ForeColor.TextBoxBase,ComboBox.ModernComboAdapter, andUpDownBase.Customer Impact
Regression?
Risk
Screenshots
Before
Changing ForeColor on editable controls in VisualStylesMode.Net11 also change the border color.
After
Editable-control border color is independent from ForeColor.
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow