问题
[VS Enterprise 2017, 15.9.14]
I just noticed this - not sure how long it has been happening. When I am editing code (any type I have seen so far - plain text, .cs, .xaml) the vertical scroll bar will change length, based on the relative amount of text characters which happen to be visible in the window. I don't like this functionality - I just want the size to be constant, based solely on the number of lines of text in the file. I have a number of extensions installed (Productivity Power Tools to name one), but I couldn't find any relevant setting in the Options dialog. Thanks for any input.
回答1:
I encountered the exact same problem in Visual Studio Professional 2019. It only occurs if I have line wrapping enabled. Disabling line wrapping (Ctrl+E, Ctrl+W) yields static vertical scrollbar lengths (based solely on the number of lines of text in the file). I noticed that it does not matter if lines are actually wrapped but only if line wrapping is enabled.
I encountered the exact same problem as the original author with vertical scroll bars changing size dynamically inside a single document depending on the amount of visible characters. I solved it by disabling line wrapping and wanted to share this solution with the original author and the community.
回答2:
If I'm understanding you correctly, this is just standard Windows behavior. Notepad does it, browsers do it, studio does it...
Imagine if, as you're suggesting, the size of the scrollbar's handle did NOT change based on the amount of visible text in the window:
In this (admittedly, extreme) example, I want my scrollbar handles to be pretty big:
Now, this text file has almost 1,000 lines in, and now I want to scroll to around line 300. I have a very small region of scrolling space in order to narrow down to that region in the file. This is why the scrollbar handle shrinks -- 1) so you have a visual indication of which part of the file you're looking at, and 2) so you have higher fidelity in larger files to quickly get where you want.
回答3:
Disabling Edit > Advanced > Word Wrap
did not resolve the issue for me (in Visual Studio 2019).
The IDE uses Map mode
by default. Microsoft have their own unique concept of what the Scrollbox
does in this mode and you have limited control, except for things like the colour (see for example Options > Environment > Fonts and Colors > Overview background
).
To get the functionality you need, go to Options > Text Editor > All Languages > Scroll Bars > Behaviour
. Select Use bar mode for vertical scroll bar
.
来源:https://stackoverflow.com/questions/57063575/visual-studio-vertical-scrollbar-changes-length-based-on-amount-of-text-on-scree