winforms icon indicating copy to clipboard operation
winforms copied to clipboard

TrackBar visually breaks with certain changes to certain properties

Open sunstriderko opened this issue 2 years ago • 6 comments

.NET version

.NET 8

Did it work in .NET Framework?

Yes

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

.NET 7

Issue description

While working on our app, we noticed there is something wrong with the default Winforms TrackBar control. Recently we updated the app to build with .NET 8 and I created a simple Winforms app to confirm this. There seems to be some visual issue with TrackBar's ticks. I also noticed there is some threshold (percentage of Width to Size/TickFrequency) where it visually breaks. I picked one combination of the properties that is easily reproducible.

TrackBar_issue

I can't reproduce the issue when building the project with .NET 7. The same issue happens when creating the controls programmatically with the specified properties.

Steps to reproduce

  • Create a new Winforms App
  • Add a TrackBar (from Toolbox) onto the Surface
  • Change Width property to 100
  • Change Maximum property to 51
  • Change TickFrequency property to 10
  • Run the App (The TrackBar looks correct while designing, it breaks during runtime)

sunstriderko avatar Jul 09 '24 08:07 sunstriderko

The issue can reproduce on .NET 8.0 and 9.0 when setting the Maximum property to 51 as below screenshot. image

Zheng-Li01 avatar Jul 09 '24 09:07 Zheng-Li01

Probably related to #8060

elachlan avatar Jul 09 '24 21:07 elachlan

@Zheng-Li01 can you check the PR @elachlan linked and try out the quirk implemented there to opt out of the feature?

merriemcgaw avatar Jul 09 '24 23:07 merriemcgaw

@elachlan, @merriemcgaw , yes, after adding the "System.Windows.Forms.TrackBarModernRendering":false in the runtimeconfig.json file, the Trackbar can work well as below screenshot. GHIssue11639

Zheng-Li01 avatar Jul 10 '24 01:07 Zheng-Li01

Verified this issue on 9.0.100-preview.7.24371.4 with dlls built from winforms repo of main branch, it was fixed: TrackBar's ticks display is normal. image

Philip-Wang01 avatar Jul 25 '24 05:07 Philip-Wang01

Verified the issue with .NET 9.0.100-preview7.24402.8 test pass build that the issue has been fixed, which have the same results as above.

Nora-Zhou01 avatar Aug 05 '24 08:08 Nora-Zhou01