I've noticed that the scrollbar on the System.Windows.Forms.Panel
appears to have a white line going down the left-side of the vertical scrollbar.
The horizontal scrollbar also has this (the white line appears above it): .
I've also noticed it with DevExpress.XtraEditors.XtraScrollableControl
when it's got UseWindowsXPTheme
set to true, so I'm guessing it may be a system thing (as this is just an example, I haven't tagged this question with the DevExpress tag).
I've noticed that in the Visual Studio 2015 Options screen, it has an example of a Scrollbar with this white line (the one on the left), AND without it (the one on the right): .
My question is: Is there any way to remove this white line from the scrollbar? If so, how? I know it may seem minor, but it's noticeable enough to be annoying.
I've tagged this question as both VB.NET and C# as I am happy to accept answers in either language.
You cannot do this unless you use your own custom controls for scrolling. This is just a 3D highlight effect on the scrollbar and the scrollbar does not have an override property to change its style to flat.
But here are some fancy custom scrollbars you can use.
CodeProject: Scrolling Panel
CodeProject: Cool Scrollbar - Scrollbar like Windows Media Player's
CodeProject: How to skin scrollbars for Panels, in C#
CodeProject: Replace a Window's Internal Scrollbar with a customdraw scrollbar Control
Well, after looking into things such as handling the Paint event for a Scrollbar control, I eventually came up with an easier and simpler (but ultimately uncomfortable) solution: Cover it with a
Label
control!This will do the trick for vertical and horizontal scrollbars for a
Panel
:As I've not seen this issue on any other operating systems, I've added a check to try and ensure that it's only enabled on Windows 10, which unfortunately uses the registry, as I'm not sure there's a reliable way to do that check otherwise on Windows 10.
Obviously if someone's using a resizeable
Control
with scrollbars, they'll want to update theLabel
sizes accordingly.