Changes and testing for 12042 review #13245
Open
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 #12042 - TreeNode and ListItem not displaying in dark mode during editing, even though application is set to be in dark mode.
Proposed changes
If the application is in dark mode, capture the parent's windows message to identify the start of editing, and change the colour of the brush to match the parent's window color.
Customer Impact
Correction of incorrect color selection.
Regression?
Risk
I tried to limit the impact of the change to only occurring when the application is in dark mode. I'm not sure of the impact, if any, on custom ListView subitems, or custom-drawn TreeNodes.
Screenshots
Before
After
Test methodology
I used the test application provided to highlight the bug in the ticket to test the new behaviour.
Note that I added the following lines (uncommitted) to tests\integration\WinformsControlsTest\Program.cs
in order to enable dark mode.
It made the buttons look hard to read.
//Application.EnableVisualStyles();
//Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
#pragma warning disable WFO5001
Application.SetColorMode(SystemColorMode.Dark);
I haven't tested with the commented out option uncommented.
Accessibility testing
Test environment(s)
Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow