Indeterminate and checked ToolStripMenuItem icons are now clearly visible in dark mode on ContextMenuStrip, MenuStrip, StatusStrip and ToolStrip drop-down buttons.#14317
Open
ricardobossan wants to merge 3 commits intodotnet:mainfrom
Conversation
`ToolStripRenderer.OnRenderItemCheck` only inverted the check mark glyph when `SystemInformation.HighContrast` was true. In regular dark mode the check mark icons (designed for light backgrounds) were drawn as-is, resulting in a dark glyph on a dark background. Extended the inversion logic in `ToolStripRenderer.OnRenderItemCheck` to also trigger when `Application.IsDarkModeEnabled` is true, using the existing `ControlPaint.CreateBitmapWithInvertedForeColor` helper. The high contrast path is preserved as a separate branch since it already handles its own background-color detection. Indeterminate and checked `ToolStripMenuItem` icons are now clearly visible in dark mode on `ContextMenuStrip`, `MenuStrip`, `StatusStrip` and `ToolStrip` drop-down buttons. No Minimal Manual - 11.0.100-preview.1.26078.121
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14317 +/- ##
===================================================
+ Coverage 77.21743% 77.24331% +0.02588%
===================================================
Files 3279 3280 +1
Lines 645138 645129 -9
Branches 47730 47737 +7
===================================================
+ Hits 498159 498319 +160
+ Misses 143289 143117 -172
- Partials 3690 3693 +3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Member
|
LGTM! |
SimonZhao888
previously approved these changes
Feb 24, 2026
LeafShi1
requested changes
Feb 24, 2026
src/System.Windows.Forms/System/Windows/Forms/Controls/ToolStrips/ToolStripRenderer.cs
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a visibility issue where checked and indeterminate ToolStripMenuItem icons were barely visible in dark mode because the dark check mark glyphs designed for light backgrounds were rendered as-is on dark backgrounds.
Changes:
- Extended the inversion logic in
ToolStripRenderer.OnRenderItemCheckto trigger for dark mode in addition to high contrast mode - Used
ControlPaint.CreateBitmapWithInvertedForeColorto invert check mark glyphs whenApplication.IsDarkModeEnabledis true
src/System.Windows.Forms/System/Windows/Forms/Controls/ToolStrips/ToolStripRenderer.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/System/Windows/Forms/Controls/ToolStrips/ToolStripRenderer.cs
Show resolved
Hide resolved
Member
|
Please consider Copilot's comments |
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 #11933
Root Cause
ToolStripRenderer.OnRenderItemCheckonly inverted the check mark glyph whenSystemInformation.HighContrastwas true. In regular dark mode the check mark icons (designed for light backgrounds) were drawn as-is, resulting in a dark glyph on a dark background.Proposed changes
Extended the inversion logic in
ToolStripRenderer.OnRenderItemCheckto also trigger whenApplication.IsDarkModeEnabledis true, using the existingControlPaint.CreateBitmapWithInvertedForeColorhelper. The high contrast path is preserved as a separate branch since it already handles its own background-color detection.Customer Impact
Indeterminate and checked
ToolStripMenuItemicons are now clearly visible in dark mode onContextMenuStrip,MenuStrip,StatusStripandToolStripdrop-down buttons.Regression?
No
Risk
Minimal
Screenshots
Before
After
Test methodology
Manual
Test environment(s)
Microsoft Reviewers: Open in CodeFlow