Scroll bar issue in visual studio?

As a Microsoft Dynamics Developer, the most important tool we use in our work on a daily basis is Visual Studio. Like many others, I have encountered a small problem that really annoyed me for a couple of days, and I wanted to share this with you and give you the solution to it.

Actually, the thing I was experiencing was a bit weird. I could not control the scroll bar in the code pane in Visual Studio. When I tried to click in the scroll bar, it would not work properly, and I also couldn’t drag it. As we all know, when you click anywhere in the scrollpane, the scroll bar goes directly to the corresponding part of the code and this saves a lot of time. So maybe someone can think that it’s not a big deal since you have the keyboard shortcuts and a mouse to scroll with. You can even navigate through the code by pressing page up/down or just use the scroll wheel on the mouse. But in a situation where you have thousands of lines of code and you want to go directly to a specific line of code, then the time that you lose, even though it is only a few seconds, that you lose adds up.

This issue is not only annoying, but it will affect your efficiency. And who wants to work inefficiently, right?

Figure 1 – The Scroll Bar in Visual Studio

I decided to google this particular problem, and quickly found other developers having the exact same issue. They also added another mystery on top of it, that I had not realized until I read their experience. The scroll bar malfunctioning was only happening if you extend the display to another (secondary) display. When using Visual Studio on the the primary display, the scroll bar starts to function again. Weird, right?

I I had to test this, so I just dragged the Visual Studio window from my secondary display to the primary display and yes, it worked!! While this is a workaround solution to the problem, my primary display is almost always my notebook computer and my secondary (and sometimes third display) is a big display to code efficiently. It is obviously not a good solution to be forced to work your notebook display while coding.

In a couple of minutes I found the solution (or the suspect) which is a new feature that has been introduced in Visual Studio 2019. If you go to Tools -> Options, and under the Environment section in General you will find the new setting called “Optimize rendering screens with different pixel densities”. In my case this was set to be true, so I unchecked it. This also required my Visual Studio to be restarted and then I tried my scroll bar again, it worked! Voilá!

Figure 2 – New Feature in Visual Studio 2019

This option is a new feature developed by Microsoft for Visual Studio 2019. This feature is intended to be used if you have different DPIs (Dots Per Inch) set on different displays and you are experiencing a blurry view, or some fonts appearing like they have a shadow. Some other parts might be affected when this option is set to true, for example context menus, most code editors, solution explorer, team explorer, breakpoints, locals and call stack. Actually, I could still not figure out why this has been an issue for so long and maybe it will be a good subject for another post. But for now, start with unchecking that setting cautiously because there can be some side effects like a blurry view of the code pane. I did not experience that side effect, but it is always good to know.

If you would like more information on the subject there is a good devblog post written by Ruben Rios, Senior Program Manager in Visual Studio – You will find the link below.

https://devblogs.microsoft.com/visualstudio/a-better-multi-monitor-experience-with-visual-studio-2019/

Happy coding!

Mirac Kocaturk
Senior Software Developer
mirac.kocaturk@sirocco.se