示例#1
0
        private void HandleDrag(object sender, Dock thumbposition, double delta)
        {
            BeatContainerAdorner adorner   = (BeatContainerAdorner)sender;
            UIElement            container = adorner.AdornedElement;

            TimeSpan changedSpan = ViewPort.Multiply(delta / ActualWidth);

            switch (thumbposition)
            {
            case Dock.Left:
            {
                TimeSpan duration = GetDuration(container) - changedSpan;
                TimeSpan position = GetPosition(container) + changedSpan;

                SetDuration(container, duration);
                SetPosition(container, position);
                break;
            }

            case Dock.Right:
            {
                TimeSpan duration = GetDuration(container) + changedSpan;
                SetDuration(container, duration);
                break;
            }

            case Dock.Top:
            {
                TimeSpan position = GetPosition(container) + changedSpan;
                SetPosition(container, position);
                break;
            }
            }
        }
 private void IncreaseViewPort()
 {
     ViewPort = ViewPort.Multiply(1.5);
 }
 private TimeSpan LengthToTimeSpan(double length)
 {
     return(ViewPort.Multiply(length / ActualWidth));
 }