Repository navigation
Fix 14062: Refactor StatusStrip DefaultPadding calculation and adjust GripWidth for improved layout consistency - #14068
Conversation
There was a problem hiding this comment.
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
DisplayRectangleproperty to reduce available space by the DPI-scaled grip width whenSizingGripis 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 Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
7f3332b
…e area of intersection between an item and a SizingGrip exceeds a certain threshold (e.g., >50%).
… space is reserved in the Padding.
|
/backport to release/10.0 |
|
Started backporting to |
|
@LeafShi1 backporting to 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 |
… 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
Fixes #14062
Proposed changes
SizingGripBounds.Widthand GripWidth for horizontal orientation, and adjusts for height differences in vertical orientation.Customer Impact
Regression?
Risk
Screenshots
Before
The right label is missing when the first ToolStripStatusLabel has Spring = True
After
The right-side label is displayed in full.
AfterChange.mp4
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow