コード例 #1
0
        private void canvasImage_LeftMouseDown(object sender, MouseButtonEventArgs e)
        {
            presentationHandler.canvas2DElementSelected(((Image)sender).Tag);
            e.Handled = true;

            if (firstClick)
            {
                Cursor             = Cursors.Hand;
                moveImage          = true;
                firstClick         = false;
                movingImageElement = (Image)sender;
                movingImage        = (Image2D)movingImageElement.Tag;
                GeneralTransform transform  = movingImageElement.TransformToAncestor(movingImageElement.Parent as Visual);
                Point            StartPoint = transform.Transform(new Point(0, 0));
                startImagePositionX = StartPoint.X;
                startImagePositionX = StartPoint.Y;

                Point RelativeMousePoint = Mouse.GetPosition(movingImageElement);
                startMousePositionX = RelativeMousePoint.X;
                startMousePositionY = RelativeMousePoint.Y;
                movingImageElement.RenderTransform = new TranslateTransform();
            }
        }