-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix disabled RichTextBox multiline text rendering in Dark Mode #14216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix disabled RichTextBox multiline text rendering in Dark Mode #14216
Conversation
- When a RichTextBox is disabled in Dark Mode, the custom painting code used `ClientRectangle` instead of the proper text formatting rectangle, causing text to render incorrectly at the control's edge rather than within the text area bounds. - The `EndEllipsis` flag was incompatible with multiline text, causing premature truncation. - Use `EM_GETRECT` to get the proper text formatting rectangle that accounts for borders and padding. - Replace `EndEllipsis` with `TextBoxControl` flag for proper multiline text rendering. - Disabled RichTextBox controls now display multiline text correctly in Dark Mode. - No - Minimal - Manual - 11.0.100-alpha.1.25618.104
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14216 +/- ##
===================================================
+ Coverage 77.15694% 77.17093% +0.01398%
===================================================
Files 3279 3279
Lines 645347 645059 -288
Branches 47721 47722 +1
===================================================
- Hits 497930 497798 -132
+ Misses 143729 143570 -159
- Partials 3688 3691 +3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
| Text, | ||
| Font, | ||
| ClientRectangle, | ||
| textBounds, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we use ClientRectangle? I think what really makes a difference is the modification to TextFormatFlags.EndEllipsis, because it indicates that when the text is too long, it will no longer be omitted with "...".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a rendering issue with disabled RichTextBox controls in Dark Mode where multiline text was not displayed correctly. The root cause was using ClientRectangle instead of the proper text formatting rectangle, and using incompatible text formatting flags.
Changes:
- Use
EM_GETRECTto retrieve the correct text formatting rectangle that accounts for borders and padding - Replace
EndEllipsisflag withTextBoxControlflag for proper multiline text rendering
Fixes #14203
Root Cause
ClientRectangleinstead of the proper text formatting rectangle, causing text to render incorrectly at the control's edge rather than within the text area bounds.EndEllipsisflag was incompatible with multiline text, causing premature truncation.Proposed changes
EM_GETRECTto get the proper text formatting rectangle that accounts for borders and padding.EndEllipsiswithTextBoxControlflag for proper multiline text rendering.Customer Impact
Regression?
Risk
Screenshots
Before
After
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow