dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.41k stars 984 forks source link

[Multi-Monitor][PermonitorV2] CheckedListBox is not display scrollbar on secondary screen #8267

Open Philip-Wang01 opened 1 year ago

Philip-Wang01 commented 1 year ago

.NET version

.NET 8.0.100-alpha.1.225727.7

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

CheckedListBox is not display scrollbar when move from 100% primary to 300% secondary monitor. image

Steps to reproduce

  1. Launch VS instance on 100% primary screen.
  2. Create a WinForms .NET Core project.
  3. Add PerMonitorV2 in csproj file.
  4. Drag and drop a checkedlistbox control to form designer and add multiple items make sure control has scrollbar.
  5. Build and run it, move to 300% secondary monitor.

Or:

  1. Extract and open Testcheckedlistbox.zip on 100% primary screen.
  2. Build and run it, move to 300% secondary monitor.

Actual result: CheckedListBox is not display scrollbar when move from 100% primary to 300% secondary monitor. image

Expected result: CheckedListBox should display scrollbar when move from 100% primary to 300% secondary monitor. image

More info:

  1. This issue doesn't repro on SystemAware and DpiUnware mode.
  2. This issue does not repro on move from 300% primary screen to 100% secondary monitor.
  3. The scrollbar is redisplayed when the mouse is dragged over the CheckedListBox on the secondary monitor.

https://user-images.githubusercontent.com/86937911/203501522-06bed95c-2385-4a2b-a62c-8364180be2b5.mp4

dreddy-work commented 1 year ago

@Philip-Wang01 , can you check if native checked listbox has this issue? I do not see any references where we adjust VScrollbars and think it must be coming from native control.

Philip-Wang01 commented 1 year ago

@dreddy-work I created an MFC Application but didn't find a CheckedListBox control, I replaced it with an MFC VSListBox Control. But this issue is only reproduced in PermonitorV2 mode, I'm not quite sure how to get the MFC application to support PermonitorV2. When I drag the MFC VSListBox Control to the secondary monitor, it remains voxelized.

image

dreddy-work commented 1 year ago

I'm not quite sure how to get the MFC application to support PermonitorV2.

did you try https://devblogs.microsoft.com/cppblog/mfc-applications-now-default-to-being-dpi-aware/#:~:text=Turning%20on%20DPI-awareness%20will%20trigger%20the%20use%20of,%28144%20DPI%29%2C%20without%20the%20DPI-awareness%20flag%20turned%20on.

dreddy-work commented 1 year ago

You can specify DpiAwareness in the manifest file too.

Philip-Wang01 commented 1 year ago

@dreddy-work Thanks for your help. Since MFC application doesn't have CheckedListBox control, I used CCheckListBox to verify this result. In this case, the MFC application cannot reproduce the problem.

https://user-images.githubusercontent.com/86937911/206420384-59ec8630-32f8-4e98-a3fa-796003f584da.mp4

There is another important information, whether to display the scrollbar seems to have a relationship with the number of items, please see the following video for details: testscr.zip

https://user-images.githubusercontent.com/86937911/206433263-e446100a-afbf-4631-a312-25b31b6484a9.mp4