Skip to content

Fix ComboBox text clipping in NET11 VisualStylesMode - #14874

Merged
KlausLoeffelmann merged 2 commits into
dotnet:mainfrom
LeafShi1:Fix_14794_ComboBox_text_clipping_issue
Aug 14, 2026
Merged

KlausLoeffelmann merged 2 commits into
dotnet:mainfrom
LeafShi1:Fix_14794_ComboBox_text_clipping_issue

Conversation

@LeafShi1

@LeafShi1 LeafShi1 commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

Root Cause

NET11 modern ComboBox layout reduced the native EDIT child height by vertical padding/chrome. For single-line EDIT, shrinking the window height can clip the text.

Proposed changes

  • Preserve the native single-line EDIT child height in modern ComboBox layout.
  • Keep bottom-boundary clamping so the EDIT child stays within the modern field.
  • Add regression coverage for DropDown and Simple editable ComboBox styles.

Customer Impact

  • In VisualStylesMode.Net11 mode, user-entered text is fully displayed, whether at design time or at runtime.

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

Editable ComboBox text could be vertically clipped.

Image

After

The EDIT child keeps its native height and is only clamped to the available control bounds, so text is no longer clipped under normal sizing.

AfterChanges.mp4

Test methodology

  • Unit test and manually

Test environment(s)

  • .net 11.0.0-rc.1.26410.101
Microsoft Reviewers: Open in CodeFlow

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses a WinForms ComboBox text-clipping issue in VisualStylesMode.Net11 by adjusting modern layout behavior so the native single-line EDIT child retains a usable height while still being clamped within the available bounds.

Changes:

  • Update modern ComboBox layout to preserve the native EDIT child height (avoiding vertical text clipping).
  • Add a regression test covering editable DropDown and Simple styles under VisualStylesMode.Net11.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/System.Windows.Forms/System/Windows/Forms/Controls/ComboBox/ComboBox.Modern.cs Preserves native EDIT child height in modern layout and clamps to available bounds.
src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs Adds a regression test to ensure editable ComboBox edit bounds height is not reduced under Net11 visual styles.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@KlausLoeffelmann KlausLoeffelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@KlausLoeffelmann
KlausLoeffelmann merged commit 277da14 into dotnet:main Aug 14, 2026
8 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Aug 15, 2026
@LeafShi1

Copy link
Copy Markdown
Member Author

/backport to release/11.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@LeafShi1 backporting to release/11.0 failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git cherry-pick 277da14a89c81f3006f36fb2b8e9d7421be8ac72

On branch backport/pr-14874-to-release/11.0
You are currently cherry-picking commit 277da14a8.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	changes.diff
	changes.patch
	merged-change.diff

nothing added to commit but untracked files present (use "git add" to track)
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git cherry-pick --skip'


$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix ComboBox text clipping in NET11 VisualStylesMode
Using index info to reconstruct a base tree...
M	src/System.Windows.Forms/System/Windows/Forms/Controls/ComboBox/ComboBox.Modern.cs
M	src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs
CONFLICT (content): Merge conflict in src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix ComboBox text clipping in NET11 VisualStylesMode
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text can get truncated in Combobox control in NET11 VisualStylesMode

3 participants