Skip to content

Conversation

@ricardobossan
Copy link
Member

@ricardobossan ricardobossan commented Jan 16, 2026

Fixes #14203

Root Cause

  • 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.

Proposed changes

  • 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.

Customer Impact

  • Disabled RichTextBox controls now display multiline text correctly in Dark Mode.

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

14203-BEFORE

After

14203-AFTER

Test methodology

  • Manual

Test environment(s)

  • 11.0.100-alpha.1.25618.104
Microsoft Reviewers: Open in CodeFlow

- 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
@ricardobossan ricardobossan self-assigned this Jan 16, 2026
@ricardobossan ricardobossan requested a review from a team as a code owner January 16, 2026 21:19
@github-actions github-actions bot added the area-DarkMode Issues relating to Dark Mode feature label Jan 16, 2026
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 77.17093%. Comparing base (ff0d8d0) to head (800a8da).
⚠️ Report is 10 commits behind head on main.

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     
Flag Coverage Δ
Debug 77.17093% <0.00000%> (+0.01398%) ⬆️
integration 18.99442% <0.00000%> (-0.00213%) ⬇️
production 52.03286% <0.00000%> (+0.00603%) ⬆️
test 97.40560% <ø> (+0.00001%) ⬆️
unit 49.48101% <0.00000%> (+0.01527%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Text,
Font,
ClientRectangle,
textBounds,
Copy link
Member

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 "...".

Copy link
Contributor

Copilot AI left a 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_GETRECT to retrieve the correct text formatting rectangle that accounts for borders and padding
  • Replace EndEllipsis flag with TextBoxControl flag for proper multiline text rendering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-DarkMode Issues relating to Dark Mode feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dark Mode] The RichTextBox not display multiline text well when setting the Enable as False

2 participants