private static bool ScrollBarParameterChanged(ScrollBarParameter scrollBarParameter1, ScrollBarParameter scrollBarParameter2) { return(scrollBarParameter1.StartValue != scrollBarParameter2.StartValue || scrollBarParameter1.EndValue != scrollBarParameter2.EndValue || scrollBarParameter1.SmallChange != scrollBarParameter2.SmallChange || scrollBarParameter1.LargeChange != scrollBarParameter2.LargeChange); }
private void UpdateVScrollBar() { int linesOnScreen = FullyVisibleLines; (double min, double max) = GetVisibleRange(linesOnScreen); (double smallChange, double largeChange) = CalcScrollChange(min, max, linesOnScreen, 1); var newScrollBarParameter = new ScrollBarParameter(min, max, smallChange, largeChange); UpdateScrollBarParameter(newScrollBarParameter); }
private void UpdateScrollBarParameter(ScrollBarParameter parameter) { bool update = curScrollBarParameter.StartValue != parameter.StartValue || curScrollBarParameter.EndValue != parameter.EndValue || curScrollBarParameter.SmallChange != parameter.SmallChange || curScrollBarParameter.LargeChange != parameter.LargeChange; if (update) { curScrollBarParameter = parameter; IntSetVScroll(curScrollBarParameter.StartValue, curScrollBarParameter.EndValue); } }
private void OnScrollBarValueChanged(System.Windows.Controls.Primitives.ScrollBar scrollBar, ScrollBarParameter parameter) { if (scrollBar != null) { double oldThumbLength = scrollBar.GetThumbLength(); double oldThumbCenter = scrollBar.GetThumbCenter(); double newThumbLength = parameter.EndValue - parameter.StartValue; double newThumbCenter = (parameter.StartValue + parameter.EndValue) / 2; bool newEnabled = (parameter.StartValue > 0 || parameter.EndValue < 1); double newMaximuum = newEnabled ? 1 : 0; if (oldThumbLength != newThumbLength || oldThumbCenter != newThumbCenter || scrollBar.SmallChange != parameter.SmallChange || scrollBar.LargeChange != parameter.LargeChange || scrollBar.IsEnabled != newEnabled || scrollBar.Maximum != newMaximuum) { scrollBar.IsEnabled = newEnabled; scrollBar.Maximum = newMaximuum; scrollBar.SmallChange = parameter.SmallChange; scrollBar.LargeChange = parameter.LargeChange; scrollBar.SetThumbLength(newThumbLength); scrollBar.SetThumbCenter(newThumbCenter); } } }
private void STextBox_VScrollBarValueChanged(object sender, ScrollBarParameter parameter) { OnScrollBarValueChanged(vScrollBar, parameter); }