/// <summary> /// Скролл вправо /// </summary> private void btScrollRight_Click(object sender, RoutedEventArgs e) { if (VisibilityRightTimeBorder.CompareTo(RightTimeBorder.Subtract(VisibilityTimeInterval)) >= 0) { VisibilityLeftTimeBorder = RightTimeBorder.Subtract(VisibilityTimeInterval); return; } TimeSpan newLeftTime = VisibilityLeftTimeBorder.Add(VisibilityTimeInterval); TimeSpan newRightTime = VisibilityRightTimeBorder.Add(VisibilityTimeInterval); if (newRightTime.CompareTo(RightTimeBorder) >= 0) { newRightTime = RightTimeBorder; newLeftTime = VisibilityLeftTimeBorder.Add(newRightTime.Subtract(VisibilityRightTimeBorder)); } VisibilityLeftTimeBorder = newLeftTime; RaiseScrolledEvent(this.scrollBarData); }
/// <summary> /// Передвижение прямоугольника видимого интервала времени /// </summary> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (ScrollingFlag) { Point position = e.GetPosition(this); TimeSpan newLeftTime = ToolFunctions.GetTimeByPoint(position, new Point(btScrollLeft.Width, 0), TimeInPoint, LeftTimeBorder); if (newLeftTime.CompareTo(LeftTimeBorder) < 0) { return; } if (newLeftTime.CompareTo(RightTimeBorder.Subtract(VisibilityTimeInterval)) > 0) { VisibilityLeftTimeBorder = RightTimeBorder.Subtract(VisibilityTimeInterval); } else { VisibilityLeftTimeBorder = newLeftTime; } RaiseScrolledEvent(this.scrollBarData); } }