Fix ScrollableControl scrollbar synchronization after property-driven display position updates#14658
Open
abineshPalanisamy wants to merge 3 commits into
Open
Fix ScrollableControl scrollbar synchronization after property-driven display position updates#14658abineshPalanisamy wants to merge 3 commits into
abineshPalanisamy wants to merge 3 commits into
Conversation
Added the fix for the Fix_Issue_3614
Added the unit test cases for Fix_Issue_3614
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a scrollbar state desynchronization in ScrollableControl when the display position is updated via the ScrollProperties.Value (property-driven) path, addressing #3614.
Changes:
- Synchronize scrollbars after
SetDisplayRectLocation(x, y)inScrollableControl.SetDisplayFromScrollProps(int x, int y)by callingSyncScrollbars(true). - Add regression tests to verify managed (
HorizontalScroll.Value) and native (GetScrollInfo) horizontal scroll positions remain aligned after property-driven display position updates.
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/Scrolling/ScrollableControl.cs | Adds a missing SyncScrollbars(true) call to keep native and managed scrollbar state consistent after display rect updates from scroll properties. |
| src/test/unit/System.Windows.Forms/System/Windows/Forms/ScrollableControlTests.cs | Adds tests validating horizontal display offset updates keep DisplayRectangle, managed scroll value, and native scrollbar position in sync. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addressed the review correction for Fix_Issue_3614
Author
|
@dotnet-policy-service agree company="Syncfusion, Inc." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3614
Proposed changes
ScrollableControl.SetDisplayFromScrollProps(int x, int y)to explicitly callSyncScrollbars(true)afterSetDisplayRectLocation(x, y). This ensures that the scrollbar state is synchronized after the display rectangle position changes through the property-driven scroll path.SetDisplayFromScrollPropsflow while completing the missing scrollbar synchronization step required after the display position is updated.ScrollableControlTestsfor property-driven horizontal scroll position updates to verify that display position changes and scrollbar synchronization remain consistent. The WinForms test suite already containsScrollableControlTests.cs, which is the appropriate location for this regression coverage.Root cause
ScrollProperties.Valueupdates the display position viaSetDisplayFromScrollProps(...).SyncScrollbars(true), which was missing in this path.Customer Impact
Regression?
Risk
Screenshots
Before
Scrollable_Before_fix.mp4
After
Scrollable_After_fix.mp4
Test methodology
SyncScrollbars(true)afterSetDisplayRectLocation(...)resolves the inconsistency between the display rectangle position and the scrollbar state in the property-driven path.ScrollableControlTeststo validate that:SetDisplayFromScrollProps(...)synchronizes the managed and native horizontal scrollbar positions, andAccessibility testing
Test environment(s)
Microsoft Reviewers: Open in CodeFlow