public void SetScrollValues(int min,
int max,
int smallChange,
int largeChange,
int offset)
{
// Update cached values (applying limit checking)
_min = Math.Max(min, 0);
_max = Math.Max(max, 0);
_smallChange = Math.Max(smallChange, 0);
_largeChange = Math.Max(largeChange, 0);
_offset = Math.Max(offset, 0);
if (_scrollBar != null)
{
// Set the scrolling values
_scrollBar.Minimum = _min;
_scrollBar.Maximum = _max;
_scrollBar.SmallChange = _smallChange;
_scrollBar.LargeChange = _largeChange;
_scrollBar.Value = Math.Max(_min, Math.Min(_max, _offset));
}
}