I am trying to implement something similar to the "infinite" Excel scrolling; in that the user can scroll to the bottom of the document; but then continue to scroll (using either the scroll wheel or the down arrow on the scroll bar), and more, empty lines are created for them. It basically works for me (when using a scroll mouse, it works fine); but I am having problems with the functionality of SmallIncrement - that is; when the user presses the down arrow on the scroll bar, he should lower himself along the scroll bar .SmallChange, despite the fact that he is below the scroll scroll range.
Here is my code (in the scrollBar_Scroll handler):
int difference = e.NewValue - e.OldValue;
if (e.Type == ScrollEventType.SmallIncrement)
{
if (difference != scrollBar.SmallChange)
{
int increase = (scrollBar.SmallChange - difference);
scrollBar.Maximum += increase;
scrollBar.Value += increase;
}
}
, , . - ( ), scrollBar.Value . , . .
, , ?
!
: . , , . MouseWheel.
int desiredValue = scrollBar.Value - e.Delta;
scrollBar.MaximumValue = (Math.Max(normalBottom, desiredValue + scrollBar.LargeChange));
scrollBar.Value = Math.Max(0, desiredValue);
normalBottom - , "" - excel , ; ( ).