I want to change the size of the actual bar/thumb part of the scrollbar in winforms but I can't find a way to do this. The thumb is about 1/10 of the actual scroll area regardless of how much there is to scroll. It's the same whether I have to scroll down 1 line or 1000 line. I want the size of it to adjust depending on how much there is to scroll or at the very least make it something like 50% the size of the scroll area.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
The from contains some property to adjust the scrolling such as:
AutoScrollMargin, AutoScrollMinSize, AutoScrollOffset
, and it also haveHorizontalScroll
andVerticalScroll
, the last two properties represents the virtecal and horizontal scroll bar of the form, they also expose some properties likeMinimum, Maximum, SmallChange, LargeChange, Value..
, If using all those does not satisfy your requirements, then you should use a customScrollbar
. AddScrollBar
to the form and disable the form scroll bar, and adjust your custom scroll bar whenever a controls added to form or changes its size...The thumb bar size of a scrollbar control is directly proportional to the difference between that control's
ScrollBarName.Maximum
andScrollBarName.LargeChange
values.To make use of
ScrollBarName.LargeChange
a proportional offset value is needed forScrollBarName.Maximum
so that the scrollbar control when used behaves as intended. The following example demonstrates how this offset calculation is made and how it is applied in a practical application context.Offset Calculation:
Application Context:
Actually I got it.
this.vScrollBar1.LargeChange = this.vScrollBar1.Maximum / 2;
changes the thumb to half the track length.