示例#1
0
        /// <summary>
        /// Defines the media element to drag.
        /// </summary>
        private void DropZone_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (!VideoControl.SourceProvider.MediaPlayer.CouldPlay)
            {
                return;
            }

            var scaleTransform = (ScaleTransform)((TransformGroup)VideoControl.RenderTransform).Children.First(tr => tr is ScaleTransform);
            var elementHeight  = VideoControl.ActualHeight * scaleTransform.ScaleY;
            var elementWidth   = VideoControl.ActualWidth * scaleTransform.ScaleX;

            if (elementWidth <= DropZone.ActualWidth && elementHeight <= DropZone.ActualHeight)
            {
                return;
            }

            VideoControl.Cursor = Cursors.SizeAll;
            DropZone.CaptureMouse();

            var translateTransform = (TranslateTransform)((TransformGroup)VideoControl.RenderTransform).Children.First(tr => tr is TranslateTransform);

            MousePosition  = e.GetPosition(DropZone);
            OriginPosition = new Point(Math.Round(translateTransform.X, MidpointRounding.AwayFromZero), Math.Round(translateTransform.Y, MidpointRounding.AwayFromZero));

            SystemParametersInfo(0x0071, 0, 3, 0);
        }