void ImagePopup_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { isDragging = true; var draggableControl = sender as UserControl; clickPosition = e.GetPosition(this); draggableControl.CaptureMouse(); }
private void Window_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { Window window = (sender as FrameworkElement).DataContext as Window; _isMoving = true; _lastPoint = e.GetPosition((sender as FrameworkElement)); (sender as FrameworkElement).CaptureMouse(); }
private static void mouse_down(object sender, System.Windows.Input.MouseButtonEventArgs e) { UIElement grid = (UIElement)sender; m_start = e.GetPosition(Window); m_startOffset = new Vector(((TranslateTransform)grid.RenderTransform).X, ((TranslateTransform)grid.RenderTransform).Y); grid.CaptureMouse(); }
protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e) { base.OnMouseDown(e); if (m_mouseDownPoint == null) { m_mouseDownPoint = e.GetPosition(this); } }
private void bCanvas_MouseLeftButtonDown_1(object sender, System.Windows.Input.MouseButtonEventArgs e) { puntero = e.GetPosition(bGridMain); posicionx = (int)puntero.X / 100; posiciony = (int)puntero.Y / 100; muestra.Text = posicionx.ToString(); }
private void WrapPanel_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { if ((_selectedImage = e.OriginalSource as Image) != null) { _MouseDownPoint = e.GetPosition(this); _readyToDrag = true; } }
private void operationImage_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { Point mousePoint = e.GetPosition(operationImage); double panPanelRadius = panIconSize * .5; double globeRadius = globeIconSize * .5; Point center = new Point(panPanelRadius, panPanelRadius); double distanceFromMouseToCenter = Math.Sqrt(Math.Pow(mousePoint.X - center.X, 2) + Math.Pow(mousePoint.Y - center.Y, 2)); if (distanceFromMouseToCenter <= globeRadius) { // zoom to whole world. if (CurrentMap != null && isGlobeButtonEnabled) { Collection <BaseShape> rectangles = new Collection <BaseShape>(); foreach (Overlay overlay in CurrentMap.Overlays) { RectangleShape rect = overlay.GetBoundingBox(); if (rect != null) { rectangles.Add(rect); } } if (rectangles.Count != 0) { RectangleShape targetExtent = OnGlobeButtonClick(ExtentHelper.GetBoundingBoxOfItems(rectangles)); if (targetExtent != null) { CurrentMap.CurrentExtent = targetExtent; CurrentMap.Refresh(); } } } e.Handled = true; } else if (distanceFromMouseToCenter <= panPanelRadius) { // change switcher mode. double degree = GetDegree(mousePoint.X - center.X, center.Y - mousePoint.Y); if ((degree >= 0 && degree < 90) || (degree <= 0 && degree >= -30)) { isSwitchedByMouse = true; SwitcherMode = SwitcherMode.TrackZoom; } else if ((degree >= 90 && degree <= 180) || (degree < -150 && degree >= -180)) { isSwitchedByMouse = true; SwitcherMode = SwitcherMode.Pan; } else { isSwitchedByMouse = true; SwitcherMode = SwitcherMode.Identify; } e.Handled = true; } }
void TextAreaMouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { var position = textEditor.GetPositionFromPoint(e.GetPosition(textEditor)); if (position.HasValue) { textEditor.TextArea.Caret.Position = position.Value; } }
private void ListBox_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { HitTestResult r = VisualTreeHelper.HitTest(this, e.GetPosition(this)); if (r.VisualHit.GetType() != typeof(ListBoxItem)) { (e.Source as ListBox).UnselectAll(); } }
void MyFrameWorkElement_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { //AdjustStartEndPosition(); var pt = e.GetPosition(this); ptSelectedWell = GetPos(pt); this.InvalidateVisual(); }
private void ViewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (e.Source is Image png) { mousePos = e.GetPosition(View); drag = png; View.CaptureMouse(); } }
private void Grid_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { MouseIsDown = true; MouseDownPosition = e.GetPosition(ImageGrid); SelectionRectangle.Visibility = Visibility.Visible; ChangeSelectionRectangle(MouseDownPosition, MouseDownPosition); ImageGrid.CaptureMouse(); }
private void ResizeRect_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { resizeStart = e.GetPosition(this); _startSize = pagesBorder.ActualHeight; resizeRect.CaptureMouse(); _isResizing = true; }
private void canvasClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { var senderType = sender.GetType(); var position = e.GetPosition(sender as Canvas); var nearestSites = GetNearestSitesToPoint(new CartesianCoord(position, false)); drawHexLines(nearestSites); //var nearestLines = getNearestLinesToPoint(new Coord(position.X, position.Y)); }
private void viewport3D1_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { dragging = false; var dragEnd = e.GetPosition(this.viewport3D1); this.dragTotal.X = dragEnd.X - this.dragStart.X; this.dragTotal.Y = dragEnd.Y - this.dragStart.Y; }
private void OnMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (!EditEnabled || !IsMouseDown) { return; } IsMouseDown = false; if (MoveMode) { current.Move(MouseDownPoint, e.GetPosition(this)); MoveMode = false; EmitDrawEvent(DrawState.End); return; } current.End = e.GetPosition(this); Draw(current); EmitDrawEvent(DrawState.End); }
private void image_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { Points ps = new Points(); ps.start = temp_p; ps.end = e.GetPosition(image); points.Add(ps); onclick = false; }
private void CloseButton_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { Point pos = e.GetPosition(CloseButton); if (e.LeftButton == System.Windows.Input.MouseButtonState.Released && pos.X >= 0 && pos.X < CloseButton.Width && pos.Y >= 0 && pos.Y < CloseButton.Height) { Close(); } }
private void radarsListView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { object item = ListViewBaseInfo.GetElementFromPoint((ItemsControl)sender, e.GetPosition((ItemsControl)sender)); if (item != null) { _radarsInfo.CenteredRadar(); } }
private void overlayImage_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { _endPoint = e.GetPosition(MaskedColor); Bitmap rawbmp = LoadImagetoBMP(MaskedColor); DrawLineInt(rawbmp, _startPoint, _endPoint); overlayImage.Source = LoadBMPtoImage(rawbmp); System.Windows.Point position = GetEdgePoint(MaskedColor, overlayImage); this.sensor.CoordinateMapper.MapColorFrameToDepthFrame(ColorFormat, DepthFormat, this.depthPixels, depthPoints); int af = (int)position.X + ((int)position.Y * 640); int depth = depthPixels[af].Depth; DepthImagePoint depthPoint = new DepthImagePoint(); depthPoint.X = (int)depthPoints[af].X; depthPoint.Y = (int)depthPoints[af].Y; depthPoint.Depth = (int)depthPoints[af].Depth; if (this._PointNumber == 0) { _sPoint1 = this.sensor.CoordinateMapper.MapDepthPointToSkeletonPoint(DepthFormat, depthPoint); if (_sPoint1.Z == 0) { System.Windows.Forms.MessageBox.Show("No Depth was found retake point"); return; } } if (this._PointNumber == 1) { _sPoint2 = this.sensor.CoordinateMapper.MapDepthPointToSkeletonPoint(DepthFormat, depthPoint); if (_sPoint2.Z == 0) { System.Windows.Forms.MessageBox.Show("No Depth was found retake point"); return; } } this._PointNumber++; if (this._PointNumber > 1) { double distance = 0.0; distance = Math.Pow(_sPoint1.X - _sPoint2.X, 2) + Math.Pow(_sPoint1.Y - _sPoint2.Y, 2); Math.Pow(_sPoint1.Z - _sPoint2.Z, 2); distance = Math.Sqrt(distance) * 1000.0 / 25.4; txtDistance.Text = distance.ToString(); } }
private void CustomVisualFrameworkElement_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { Point mouse = e.GetPosition(this); VisualTreeHelper.HitTest( this, null, new HitTestResultCallback(HitTestCallBack), new PointHitTestParameters(mouse)); }
void AssociatedObject_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (canvas == null) { canvas = (Canvas)VisualTreeHelper.GetParent(this.AssociatedObject); } isDragging = true; mouseOffset = e.GetPosition(AssociatedObject); AssociatedObject.CaptureMouse(); }
private void AssociatedObject_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (!e.MouseDevice.Target.CaptureMouse()) { return; } ClosestCanvas = FindParentOf <Canvas>(AssociatedObject); _initialPosition = e.GetPosition(AssociatedObject); e.Handled = true; }
/// <summary> /// On mouse Down event /// </summary> private void OnCanvasMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { //get point var p = e.GetPosition(_drawCanvas); if (OnClick != null) { OnClick(new Point(p.X, p.Y)); } }
private void Connector_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (_isDragging) { var documentDataContext = _documentView.DataContext as DocumentViewModel; documentDataContext?.EndDrawConnectionLine(e.GetPosition(_documentView)); _isDragging = false; } this.ReleaseMouseCapture(); }
void SliderPanel_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { this.CaptureMouse(); this.MouseStart = e.GetPosition(this); this.MouseNow = this.MouseStart; this.MouseFirst = this.MouseStart; this.MouseMove += new System.Windows.Input.MouseEventHandler(SliderPanel_MouseMove); }
private void Results_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { var treeView = e.Source as TreeView; var selectedUiElement = treeView?.InputHitTest(e.GetPosition(treeView)) as FrameworkContentElement; if (ResultModelHelper.Edit(selectedUiElement?.DataContext as ResultModelBase)) { e.Handled = true; } }
private void RootImage_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { var s = e.GetPosition(this); PointerPosition = new Point { X = ImageData.boundingRect.MinX + s.X / XFactor, Y = ImageData.boundingRect.MaxY - s.Y / YFactor }; }
private static void UIElement_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { var element = sender as UIElement; if (element == null) { return; } var lastClickLocation = element.GetValue(LastClickLocationProperty) as Point?; var lastClickTime = element.GetValue(LastClickTimeProperty) as int?; if (lastClickLocation.HasValue && lastClickTime.HasValue) { if (e.Timestamp - lastClickTime.Value > SystemInformation.DoubleClickTime) { element.SetValue(LastClickLocationProperty, e.GetPosition(element)); element.SetValue(LastClickTimeProperty, e.Timestamp); return; } var size = SystemInformation.DoubleClickSize; var rect = new Rect(lastClickLocation.Value, lastClickLocation.Value); rect.Inflate(size.Width / 2, size.Height / 2); if (rect.Contains(e.GetPosition(element))) { var contentControl = element as ContentControl; if (contentControl != null) { Debug.WriteLine($"Clipboard set to: \"{contentControl.Content.ToString()}\""); System.Windows.Clipboard.SetText(contentControl.Content.ToString()); } var textBlock = element as TextBlock; if (textBlock != null) { Debug.WriteLine($"Clipboard set to: \"{textBlock.Text}\""); System.Windows.Clipboard.SetText(textBlock.Text); } ClearDoubleClickProperties(element); return; } } element.SetValue(LastClickLocationProperty, e.GetPosition(element)); element.SetValue(LastClickTimeProperty, e.Timestamp); }
protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e) { _oldMousePoint = e.GetPosition(null); this.SetSelected(true); base.OnMouseDown(e); e.Handled = true; }