Skip to content

Fix 14062: Refactor StatusStrip DefaultPadding calculation and adjust GripWidth for improved layout consistency - #14068

Merged
LeafShi1 merged 8 commits into
dotnet:mainfrom
LeafShi1:Issue_14062_reserve_display_space_for_ToolStripStatusLabel
Dec 9, 2025
Merged

LeafShi1 merged 8 commits into
dotnet:mainfrom
LeafShi1:Issue_14062_reserve_display_space_for_ToolStripStatusLabel

Conversation

@LeafShi1

@LeafShi1 LeafShi1 commented Nov 20, 2025 •

Copy link
Copy Markdown
Member

Fixes #14062

Proposed changes

  • GripWidth Adjustment
    • Changed GripWidth from 12 to 15 to improve visual balance and reduce unnecessary space.
  • Refactored DefaultPadding Logic
    • Previous implementation used hardcoded values: Padding(1, 0, 14, 0) or Padding(1, 3, 1, DefaultSize.Height).
    • New implementation dynamically calculates padding based on SizingGripBounds.Width and GripWidth for horizontal orientation, and adjusts for height differences in vertical orientation.
  • Update unit test and add StatusStrip to DemoConsole

Customer Impact

  • Prevents labels and items from being pushed out of view due to fixed padding values.

Regression?

  • Yes

Risk

  • Minimal

Screenshots

Before

The right label is missing when the first ToolStripStatusLabel has Spring = True

image

After

The right-side label is displayed in full.

AfterChange.mp4

Test methodology

  • Manually

Test environment(s)

  • 10.0.0-rc.3.25569.110
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 PR fixes issue #14062 by overriding the DisplayRectangle property in StatusStrip to properly exclude the sizing grip width when SizingGrip is enabled. This prevents ToolStripStatusLabel items from overlapping with or being truncated by the grip, especially when using Spring = true.

Key changes:

  • Override DisplayRectangle property to reduce available space by the DPI-scaled grip width when SizingGrip is enabled
  • Handle RTL layouts by adjusting both X position and width for right-to-left, or just width for left-to-right
  • Document the new public API surface in PublicAPI.Unshipped.txt

Reviewed Changes

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

File Description
StatusStrip.cs Adds DisplayRectangle property override to exclude sizing grip width from layout space when SizingGrip is enabled, with proper DPI scaling and RTL handling
PublicAPI.Unshipped.txt Documents the new public API surface for the DisplayRectangle override

@codecov

codecov Bot commented Nov 21, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.77778% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 77.15632%. Comparing base (8622bfb) to head (4416e4d).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #14068         +/-   ##
===================================================
- Coverage   77.15882%   77.15632%   -0.00251%     
===================================================
  Files           3279        3279                 
  Lines         645317      645325          +8     
  Branches       47718       47720          +2     
===================================================
- Hits          497919      497909         -10     
- Misses        143711      143727         +16     
- Partials        3687        3689          +2     
Flag Coverage Δ
Debug 77.15632% <97.77778%> (-0.00251%) ⬇️
integration 18.98598% <0.00000%> (-0.00993%) ⬇️
production 52.02241% <90.00000%> (-0.00492%) ⬇️
test 97.40749% <100.00000%> (ø)
unit 49.46813% <90.00000%> (-0.00035%) ⬇️

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.

SimonZhao888
SimonZhao888 previously approved these changes Nov 21, 2025
ricardobossan
ricardobossan previously approved these changes Nov 26, 2025

@ricardobossan ricardobossan 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.

All LGTM!

@LeafShi1
LeafShi1 dismissed stale reviews from ricardobossan and SimonZhao888 via 7f3332b November 26, 2025 10:40
@LeafShi1 LeafShi1 changed the title Fix 14062: Exclude sizing grip width from DisplayRectangle when SizingGrip is enabled Fix 14062: Refactor StatusStrip DefaultPadding calculation and adjust GripWidth for improved layout consistency Dec 5, 2025

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

LGTM!

@LeafShi1
LeafShi1 merged commit 5d64bba into dotnet:main Dec 9, 2025
@LeafShi1

LeafShi1 commented Dec 9, 2025

Copy link
Copy Markdown
Member Author

/backport to release/10.0

@LeafShi1
LeafShi1 deleted the Issue_14062_reserve_display_space_for_ToolStripStatusLabel branch December 9, 2025 02:16
@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

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

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

Applying: Fix 14062: Exclude sizing grip width from DisplayRectangle when SizingGrip is enabled
Using index info to reconstruct a base tree...
M	src/System.Windows.Forms/PublicAPI.Unshipped.txt
Falling back to patching base and 3-way merge...
Auto-merging src/System.Windows.Forms/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/System.Windows.Forms/PublicAPI.Unshipped.txt
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 14062: Exclude sizing grip width from DisplayRectangle when SizingGrip is enabled
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

LeafShi1 added a commit to LeafShi1/winforms that referenced this pull request Dec 9, 2025
… GripWidth for improved layout consistency (dotnet#14068)

Fixes dotnet#14062 


## Proposed changes

- **GripWidth Adjustment**
    - Changed GripWidth from 12 to 15 to improve visual balance and reduce unnecessary space.
- **Refactored DefaultPadding Logic**
    - Previous implementation used hardcoded values: Padding(1, 0, 14, 0) or Padding(1, 3, 1, DefaultSize.Height).
    - New implementation dynamically calculates padding based on `SizingGripBounds.Width` and GripWidth for horizontal orientation, and adjusts for height differences in vertical orientation.
- **Update unit test and add StatusStrip to DemoConsole** 

<!-- We are in TELL-MODE the following section must be completed -->

## Customer Impact

- Prevents labels and items from being pushed out of view due to fixed padding values.

## Regression? 

- Yes
@Olina-Zhang Olina-Zhang added this to the .NET 11 milestone Dec 9, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VS2026 .Net10 WinForms - Missing ToolStripStatusLabel on StatusStrip when using TooStripStatusLabel.Spring=true

6 participants