Ejemplo n.º 1
0
        public override void EndMove(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler)
        {
            int  iMousePosition  = ((ruler.Orientation == enumOrientation.orHorizontal) ? e.X : e.Y);
            long lNewMillisecond = (long)ruler.PixelToScaleValue(iMousePosition);

            KeyFrame keyClosest = ruler.KeyFrames.FindClosest(KeyFrame.enumKeyFrameType.Snapshot, lNewMillisecond, true);

            //If we can not find a single frame close to the current end position that is within the current time zone then move
            //it back to the currenttime. Otherwise move it to the closest key frame.
            if (keyClosest != null)
            {
                SetTimes(keyClosest.StartMillisecond);
                ruler.CurrentMillisecond = keyClosest.StartMillisecond;
                ruler.OnCurrentFrameMoved(keyClosest);
            }
            else
            {
                SetTimes(ruler.ActualMillisecond);
                ruler.CurrentMillisecond = ruler.ActualMillisecond;
                ruler.OnCurrentFrameMoved(null);
            }

            ruler.RedrawBitmap();
        }