dotnet / dotnet/winforms

[Multi-Monitor][PerMonitorV2] ScrollBar is not scaled well on secondary screen

Open
#8,580 0 comments 0 reactions 1 assignee Claimed by @ricardobossan View on GitHub
area-HDPI-PMv2
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### .NET version

.NET 8.0.100-preview.2.23106.11

### Did it work in .NET Framework?

Yes

### Did it work in any of the earlier releases of .NET Core or .NET 5+?

No, it also repro on .NET 6.0 & 7.0.

### Issue description

ScrollBar(HScrollBar&VScrollBar) control is not scaled well in secondary screen under PermonitorV2 mode. https://github.com/dotnet/winforms/pull/8312 solved the problem of rectangular shadows not being displayed. But move from 300% DPI to 100% DPI, scrollbars should display the same result as 100% scrollbars. Move from 100% DPI to 300% DPI, scrollbars should display the same result as 300% scrollbars.

### Steps to reproduce

1. Launch VS instance on 300% primary screen.
2. Create a WinForms .NET Core project.
3. Add `PerMonitorV2` in csproj file.
4. Add a HScrollBar and VScrollBar to form designer.
5. Build and run it, move to 100% secondary monitor.

Or

1. Extract and open [testscrollbar.zip](https://github.com/dotnet/winforms/files/10673549/testscrollbar.zip) on 300% primary screen.
2. Build and run it.
3. Move to 100% secondary monitor.

**Actual result:**
ScrollBar is not scaled well when move from 300% primary screen to 100% secondary monitor.
300% primary screen:
![image](https://user-images.githubusercontent.com/86937911/217186259-18753688-b284-4563-9ee5-281a3ecd6c4d.png)
move to 100% secondary monitor
![image](https://user-images.githubusercontent.com/86937911/217186659-ed6ba1b9-8e01-4c40-bdc1-0421c87af8f4.png)

**Expected result:**
ScrollBar should be scaled well when move from 300% primary screen to 100% secondary monitor.

**More info:**
1. This issue doesn't repro on SystemAware and DpiUnware mode.
2. The original issue: https://github.com/dotnet/winforms/issues/8270.
3. https://github.com/dotnet/winforms/pull/8312 solved the problem of rectangular shadows not being displayed. But move from 300% DPI to 100% DPI, scrollbars should display the same result as 100% scrollbars. Move from 100% DPI to 300% DPI, scrollbars should display the same result as 300% scrollbars.
4. This issue also occur when move from 100% primary to 300% secondary monitor.
100% primary screen:
![image](https://user-images.githubusercontent.com/86937911/217187226-e88c0dd9-05cc-4ddb-ad22-34639000f702.png)
move to 300% secondary monitor:
![image](https://user-images.githubusercontent.com/86937911/217188159-abd8ecc0-49e0-45f6-b6d7-e935199c2198.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.