Exemplo n.º 1
0
        private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (_doubleClickTimer.IsEnabled)
            {
                _doubleClickTimer.Stop();
                //MessageBox.Show("fwsgw");
                //_isMouseCaptured = false;
                //if (this.Name != "StartFlow" && this.Name != "EndFlow")
                _container.RuleActiveSet(this.Name);

                //    _container.ShowActivitySetting(this);
            }
            else
            {
                _doubleClickTimer.Start();
                //    this.SetValue(Canvas.ZIndexProperty, _container.NextMaxIndex);

                FrameworkElement element = sender as FrameworkElement;
                //  mousePosition = e.GetPosition(null);

                if (null != element)
                {
                    element.CaptureMouse();
                    element.Cursor = Cursors.Hand;
                }
            }
        }
Exemplo n.º 2
0
        private void Shape_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            pointHadActualMove     = false;
            trackingPointMouseMove = false;
            this._container.ResetZoom();
            FrameworkElement element = e.OriginalSource as FrameworkElement;

            if (element != null)
            {
                //((IShape)this.ShapeActivity).Fill(Colors.Blue, 0.8);

                mousePosition = e.GetPosition(this._cnsParent);
                //originalPosition = e.GetPosition(null);
                originalPosition = mousePosition;
                x = mousePosition.X - Canvas.GetLeft(ShapeActivity);
                y = mousePosition.Y - Canvas.GetTop(ShapeActivity);

                element.Cursor = Cursors.Hand;

                trackingPointMouseMove = true;
                element.CaptureMouse();

                e.Handled = true;
            }
        }
        private void DragBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;

            m_ClickCount++;
            m_LastArgs = e;
            resDoubleClickTimer.Begin();

            MoveToTop();

            //Start Drag
            FrameworkElement DragBar = (FrameworkElement)sender;

            DragBar.CaptureMouse();

            // Set the starting point for the drag
            try
            {
                StartingDragPoint = e.GetPosition(DragBar);
                IsDrag            = true;

                DragBar.MouseMove         += new MouseEventHandler(DragBar_MouseMove);
                DragBar.MouseLeftButtonUp += new MouseButtonEventHandler(DragBar_MouseLeftButtonUp);
            }catch
            {
                IsDrag = false;
            }
        }
Exemplo n.º 4
0
        public void StartDrag(IActionControl mousecontrol, Point startpoint)
        {
            this.frontcanvas.Visibility = System.Windows.Visibility.Visible;

            this.frontcanvas.Children.Clear();

            FrameworkElement dragcontrol = null;

            foreach (var item in GetSelectItems())
            {
                var x = Canvas.GetLeft(item.Element);
                var y = Canvas.GetTop(item.Element);

                Image image = new Image();
                image.DataContext = item;
                image.Source      = item.DefaultView;
                image.Width       = item.Element.ActualWidth;
                image.Height      = item.Element.ActualHeight;
                this.frontcanvas.Children.Add(image);
                Canvas.SetLeft(image, x);
                Canvas.SetTop(image, y);

                if (mousecontrol.Equals(item))
                {
                    dragcontrol = image;
                }
            }

            this.frontcanvas.ElementBeingDragged = dragcontrol;
            this.frontcanvas.StartDrag(startpoint);

            dragcontrol.Loaded += (s, e) => dragcontrol.CaptureMouse();
        }
        private void selectionArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (!MoveSelection)
            {
                _lastMousePosition = e.GetPosition(_imageElement);

                if (SelectionMode == ImageEditorSelectionMode.FixedSize)
                {
                    Point secondPosition = new Point(_lastMousePosition.X + _scaleFactor * RequiredSelectionWidth,
                                                     _lastMousePosition.Y + _scaleFactor * RequiredSelectionHeight);

                    UpdateSelection(_lastMousePosition, secondPosition);
                }
                else
                {
                    UpdateSelection(new Point(0, 0), new Point(0, 0));

                    _isSelecting = true;

                    if (_selectionArea != null)
                    {
                        _selectionArea.CaptureMouse();
                    }
                }

                e.Handled = true;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Event raised when the mouse is pressed down on a keyframe.
        /// </summary>
        private void Keyframe_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton != MouseButton.Left)
            {
                return;
            }

            FrameworkElement  keyframe          = (FrameworkElement)sender;
            KeyframeViewModel keyframeViewmodel = (KeyframeViewModel)keyframe.DataContext;

            isLeftMouseDownOnKeyframe = true;

            if ((Keyboard.Modifiers & ModifierKeys.Control) != 0)
            {
                //
                // Control key was held down.
                // This means that the keyframe is being added to or removed
                // from the existing selection. Don't do anything yet,
                // we will act on this later in the MouseUp event handler.
                //
                isLeftMouseAndControlDownOnKeyframe = true;
            }
            else
            {
                //
                // Control key is not held down.
                //
                isLeftMouseAndControlDownOnKeyframe = false;

                if (this.listBox.SelectedItems.Count == 0)
                {
                    //
                    // Nothing already selected, select the item.
                    //
                    this.listBox.SelectedItems.Add(keyframeViewmodel);
                }
                else if (this.listBox.SelectedItems.Contains(keyframeViewmodel))
                {
                    //
                    // Item is already selected, do nothing.
                    // We will act on this in the MouseUp if there was no drag operation.
                    //
                }
                else
                {
                    //
                    // Item is not selected.
                    // Deselect all, and select the item.
                    //
                    this.listBox.SelectedItems.Clear();
                    this.listBox.SelectedItems.Add(keyframeViewmodel);
                }
            }

            keyframe.CaptureMouse();
            origMouseDownPoint = e.GetPosition(GridContainer);
            listBox.Focus();
            Keyboard.Focus(listBox);
            e.Handled = true;
        }
Exemplo n.º 7
0
        internal void OnDragStart(FrameworkElement child, Point origin, Point position)
        {
            if (child == null)
            {
                return;
            }

            Dispatcher.Invoke(() =>
            {
                child.Opacity = DragOpacity;
                child.SetValue(ZIndexProperty, DragZ);
                // Dragging point within the moving element
                dragStart = new Point(origin.X * DragScale, origin.Y * DragScale);
                // Apply transform without moving the element
                Point translatePosition = child.TranslatePoint(new Point(-child.Margin.Left, -child.Margin.Top), this);
                child.RenderTransform   = CreateTransform(translatePosition.X, translatePosition.Y, DragScale, DragScale);
                // Capture further mouse events
                child.CaptureMouse();
                // Record the initial position of the element
                dragSourcePage = GetPageIndex(position);
                dragSourceCell = GetCellIndex(position);
                //
                dragging = child;
            });
        }
Exemplo n.º 8
0
        private static void OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement draggedElement = (FrameworkElement)sender;

            FrameworkElement attachedToElement = GetAttachedToElement(draggedElement);

            FrameworkElement dragContainerElement =
                GetDragContainerElement(attachedToElement);

            if (!draggedElement.CaptureMouse())
            {
                return;
            }

            Point startDragPoint = e.GetPosition(dragContainerElement);

            SetStartDragPoint(attachedToElement, startDragPoint);
            Point currentElementPoint = GetShift(attachedToElement);

            SetStartElementPoint(attachedToElement, currentElementPoint);
            Point startLocationWithinContainerElementPoint = draggedElement.TranslatePoint(new Point(), dragContainerElement);

            SetStartLocationWithinContainerElement(attachedToElement, startLocationWithinContainerElementPoint);

            SetCurrentlyDraggedElement(dragContainerElement, draggedElement);
            draggedElement.MouseMove += DraggedElement_MouseMove;
            draggedElement.MouseUp   += DraggedElement_MouseUp;
        }
Exemplo n.º 9
0
        private void DesignerContainer_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            pointHadActualMove     = false;
            trackingPointMouseMove = false;

            mousePosition    = e.GetPosition(this.cnsDesignerContainer);
            originalPosition = e.GetPosition(this.cnsDesignerContainer);

            FrameworkElement element = e.OriginalSource as FrameworkElement;

            if (element == null)
            {
                return;
            }
            if (element.Name != this.cnsDesignerContainer.Name)
            {
                for (int i = 0; i < this.SelectedElements.Count; i++)
                {
                    ((IControlBase)this.SelectedElements[i]).SetXY(mousePosition);
                }

                element.Cursor = Cursors.Hand;

                trackingPointMouseMove = true;
            }
            else
            {
                this.SelectedElementRemoveAll();
                startSelectArea = true;
                this.Focus();
            }
            element.CaptureMouse();
            e.Handled = true;
        }
Exemplo n.º 10
0
 void gripHook_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     _isResizing  = true;
     _resizePoint = e.GetPosition(_gripHook);
     _gripHook.CaptureMouse();
     e.Handled = true;
 }
Exemplo n.º 11
0
        private static void control_MouseDown(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement element = sender as FrameworkElement;

            if (element == null)
            {
                return;
            }

            TranslateTransform translate = _draggables[element].Translate;

            if (translate == null)
            {
                return;
            }

            _initialMouseOffset     = element.PointToScreen(e.GetPosition(element));
            _initialTranslateOffset = new Vector(translate.X, translate.Y);

            // turning on dragging
            _draggables[element].IsDragging = true;

            element.CaptureMouse();
            element.Cursor = Cursors.SizeAll;
        }
Exemplo n.º 12
0
 private void scrollViewer_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
 {
     _content.CaptureMouse();
     _scrollMousePoint = e.GetPosition(_scrollViewer);
     _vOff             = _scrollViewer.VerticalOffset;
     _hOff             = _scrollViewer.HorizontalOffset;
 }
Exemplo n.º 13
0
 private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     e.Handled     = true;
     hadActualMove = false;
     if (_doubleClickTimer.IsEnabled)
     {
         if (System.Windows.Browser.HtmlPage.Document.QueryString.ContainsKey("WorkID") ||
             System.Windows.Browser.HtmlPage.Document.QueryString.ContainsKey("FK_Flow"))
         {
             return;
         }
         _doubleClickTimer.Stop();
         tbLabelName.Visibility       = Visibility.Visible;
         txtLabelName.Visibility      = Visibility.Collapsed;
         Container.IsSomeChildEditing = true;
     }
     else
     {
         _doubleClickTimer.Start();
         FrameworkElement element = sender as FrameworkElement;
         mousePosition     = e.GetPosition(null);
         trackingMouseMove = true;
         if (null != element)
         {
             element.CaptureMouse();
             element.Cursor = Cursors.Hand;
         }
     }
 }
Exemplo n.º 14
0
        private void Shape_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            pointHadActualMove     = false;
            trackingPointMouseMove = false;

            if (this.Container.IsMultiSelected(this) && !this.Container.CtrlKeyIsPress)
            {
                return;
            }

            FrameworkElement element = e.OriginalSource as FrameworkElement;

            if (element != null)
            {
                this.SetMeSelected();

                mousePosition    = e.GetPosition(cnContainer);
                originalPosition = e.GetPosition(cnContainer);

                x = mousePosition.X - Canvas.GetLeft(ShapeBegin);
                y = mousePosition.Y - Canvas.GetTop(ShapeBegin);

                element.Cursor = Cursors.Hand;

                trackingPointMouseMove = true;
                element.CaptureMouse();

                e.Handled = true;
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Start panning: start capturing mouse by map and remember position
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void MapMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var position = e.GetPosition(_map);

            _map.CaptureMouse();
            _zoomer.PanOrigin = position;
        }
Exemplo n.º 16
0
 private void startAppMouseTracking()
 {
     trackingRotation              = true;
     RotateRing.MouseMove         += RotateRing_MouseMove;
     RotateRing.MouseLeftButtonUp += RotateRing_OnLostCapture;
     RotateRing.CaptureMouse();
 }
Exemplo n.º 17
0
 private void OnRootMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     _isLeftButtonDown = true;
     _startPoint       = e.GetPosition(this);
     _partRoot.CaptureMouse();
     e.Handled = true;
 }
Exemplo n.º 18
0
        private void Arrowhead_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (this.Container.IsMultiSelected(this.lineControl))
            {
                return;
            }

            pointHadActualMove     = false;
            trackingPointMouseMove = false;

            FrameworkElement element = e.OriginalSource as FrameworkElement;

            if (element != null)
            {
                _MoveType      = LineMoveType.None;
                _MoveType      = LineMoveType.Line;
                mousePosition  = e.GetPosition(this.UIContainer);
                element.Cursor = Cursors.Hand;

                if (_MoveType != LineMoveType.None)
                {
                    trackingPointMouseMove = true;
                    element.CaptureMouse();
                }
            }
        }
Exemplo n.º 19
0
        void _control_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var point = e.GetPosition(_control);

            _pressed = true;
            _control.CaptureMouse();
            _prevPoint = _control.PointToScreen(point);
        }
Exemplo n.º 20
0
 private void Handle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     FrameworkElement Item = sender as FrameworkElement;
     Item.CaptureMouse();
     Item.Cursor = Cursors.Hand;
     IsMouseCaptured = true;
     LastPosition = e.GetPosition(null);
 }
Exemplo n.º 21
0
        static void Element_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement fEle = sender as FrameworkElement;

            isDragDropInEffect = true;
            pos = e.GetPosition(null);
            fEle.CaptureMouse();
        }
        private void control_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var point = e.GetPosition(mControl);

            isPressed = true;
            mControl.CaptureMouse();
            prevPoint = mControl.PointToScreen(point);
        }
Exemplo n.º 23
0
        private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            _mouseStartPosition = e.GetPosition(_container);

            _element.Opacity = 0.2;

            _element.CaptureMouse( );
        }
Exemplo n.º 24
0
 void desk_sp_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     currentElement = sender as FrameworkElement;
     currentElement.CaptureMouse();    //鼠标捕获
     isSecect   = true;                //选中
     startPoint = e.GetPosition(null); //获取当前坐标
     endPoint   = e.GetPosition(null);
 }
Exemplo n.º 25
0
        private void theKidImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement element = sender as FrameworkElement;

            anotherPoint = e.GetPosition(null);
            element.CaptureMouse();
            isInDrag  = true;
            e.Handled = true;
        }
 private void Point_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     _DragedElement = sender as FrameworkElement;
     if (_DragedElement != null)
     {
         _DragOffset = (Vector)e.GetPosition(_DragedElement) - new Vector(_DragedElement.Width / 2.0, _DragedElement.Height / 2.0);
         _DragedElement.CaptureMouse();
     }
 }
Exemplo n.º 27
0
        private void Grid_MouseDownpopup(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement   element   = sender as Grid;
            TranslateTransform translate = element.RenderTransform as TranslateTransform;

            m_start       = e.GetPosition(gridnewresult);
            m_startOffset = new Vector(translate.X, translate.Y);
            element.CaptureMouse();
        }
Exemplo n.º 28
0
        private void DragDropPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement c = (FrameworkElement)sender;

            dragOn     = true;
            beginP     = e.GetPosition(null);
            c.Opacity *= 0.5;
            c.CaptureMouse();
        }
Exemplo n.º 29
0
 /// <summary>
 /// Handles the <see cref="Rectangle.MouseDown"/> event of the hue surface.
 /// </summary>
 /// <param name="sender">The object where the event handler is attached.</param>
 /// <param name="e">The event data.</param>
 private void OnHuePickerRenderSurfaceMouseDown(object sender, [NotNull] MouseButtonEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         huePickerRenderSurface.CaptureMouse();
         suspendBindingUpdates = true;
         UpdateHuePickerFromMouse(e.GetPosition(huePickerRenderSurface));
     }
 }
Exemplo n.º 30
0
        private void Element_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement fEle = sender as FrameworkElement;

            isDragDropInEffect = true;
            pos = e.GetPosition(this);
            fEle.CaptureMouse();
            fEle.Cursor = Cursors.Hand;
        }