void AssociatedObject_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (this.adorner != null)
     {
         this.adorner.UpdatePosition(this.AssociatedObject.PointFromScreen(MouseHelper.GetMousePosition()));
     }
 }
Esempio n. 2
0
        private void MoveToCursorPosition()
        {
            var position = MouseHelper.GetMousePosition();

            //Change coordinates to be more accurate and not to interfere user
            this.Left = position.X + 10;
            this.Top  = position.Y - 120;
        }
 private void UserControl_GiveFeedback(object sender, GiveFeedbackEventArgs e)
 {
     if (dragControl != null)
     {
         var mousePosScreen = MouseHelper.GetMousePosition(); //mainWindow.MousePosition;
         mainWindow.textBox_CustomQuestion.Text = mousePosScreen.X + "; " + mousePosScreen.Y;
         //var mousePosDoc = Mouse.GetPosition(this);
         //var mousePosScreen = this.PointToScreen(mousePosWindow);
         var topLeft  = mainWindow.PointFromScreen(new Point(mousePosScreen.X - mouseDownPos.X, mousePosScreen.Y - mouseDownPos.Y));
         var botRight = mainWindow.PointFromScreen(new Point(mousePosScreen.X - mouseDownPos.X + dragControl.Width, mousePosScreen.Y - mouseDownPos.Y + dragControl.Height));
         //docDragControl.Margin = new Thickness(mousePosWindow.X - mousePosDoc.X, mousePosWindow.Y - mousePosDoc.Y, gridMain.ActualWidth, 100);
         //docDragControl.Margin = new Thickness(topLeft.X, topLeft.Y, mainWindow.ActualWidth - botRight.X, mainWindow.ActualHeight - botRight.Y);
         //canvas.SetTop(docDragControl, topLeft.Y);
         Canvas.SetLeft(dragControl, topLeft.X);
         Canvas.SetTop(dragControl, topLeft.Y);
     }
 }
Esempio n. 4
0
        private void OnGiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            if (LinkPreviewBehavior.LinkPreview == null)
            {
                return;
            }

            // TODO cached this maybe. not efficient here
            GraphAreaBase graphArea   = AssociatedObject.FindVisualParentOfType <GraphAreaBase>();
            ZoomControl   zoomControl = graphArea.FindVisualParentOfType <ZoomControl>();

            Vector halfsize = new Vector((double)(e.OriginalSource as UIElement).GetValue(FrameworkElement.WidthProperty) / 2.0,
                                         (double)(e.OriginalSource as UIElement).GetValue(FrameworkElement.HeightProperty) / 2.0);

            LinkPreviewBehavior.LinkPreview.SetCurrentValue(UIElement.IsEnabledProperty, true);
            LinkPreviewBehavior.LinkPreview.Start = (e.OriginalSource as UIElement).TranslatePoint(new Point(0, 0), graphArea) + halfsize;
            LinkPreviewBehavior.LinkPreview.End   = zoomControl.TranslatePoint(MouseHelper.GetMousePosition(zoomControl), graphArea);
        }
Esempio n. 5
0
        protected override void OnGiveFeedback(GiveFeedbackEventArgs e)
        {
            base.OnGiveFeedback(e);

            if (this.adorner != null)
            {
                this.adorner.UpdatePosition(this.PointFromScreen(MouseHelper.GetMousePosition()));
            }

            if (e.Effects.HasFlag(DragDropEffects.Move))
            {
                Mouse.SetCursor(Cursors.Hand);
            }
            else
            {
                Mouse.SetCursor(Cursors.Arrow);
            }

            e.Handled = true;
        }
Esempio n. 6
0
 public static Point GetMousePosition(UIElement zoomControl, UIElement area)
 {
     // Convert position from zoomcontrol space to graph space
     return(zoomControl.TranslatePoint(MouseHelper.GetMousePosition(zoomControl), area));
 }