private void OnSplitterDragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { LayoutGridResizerControl splitter = sender as LayoutGridResizerControl; var rootVisual = this.FindVisualTreeRoot() as Visual; var trToWnd = TransformToAncestor(rootVisual); Vector transformedDelta = trToWnd.Transform(new Point(e.HorizontalChange, e.VerticalChange)) - trToWnd.Transform(new Point()); if (Orientation == System.Windows.Controls.Orientation.Horizontal) { Canvas.SetLeft(_resizerGhost, MathHelper.MinMax(_initialStartPoint.X + transformedDelta.X, 0.0, _resizerWindowHost.Width - _resizerGhost.Width)); } else { Canvas.SetTop(_resizerGhost, MathHelper.MinMax(_initialStartPoint.Y + transformedDelta.Y, 0.0, _resizerWindowHost.Height - _resizerGhost.Height)); } }
/// <summary> /// 向右拉时,对高度进行调整 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Thumb_DragDelta_1(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { try { System.Windows.Point position = Mouse.GetPosition(this); if (position.X > 10 && position.Y > 10) { this.Width = position.X; } } catch (Exception ex) { MethodLb.CreateLog(this.GetType().FullName, "Thumb_DragDelta_1", ex.ToString(), sender, e); } finally { } }
// Event on change of slider - to popularityFrom private void Slider_DragDelta_3(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { Slider slider = sender as Slider; if (slider != null) { popularityFrom = (int)slider.Value; PopularitySliderFromTextBlock.Text = popularityFrom.ToString(); if (BindPopularity) { PopularitySliderToTextBlock.Background = Brushes.White; PopularitySliderToTextBlock.Text = popularityFrom.ToString(); } RefreshChoices(); } }
private void OnDragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { if (Keyboard.Modifiers == ModifierKeys.Control) { TV.EndTime += TV.XToTime(e.HorizontalChange) - TV.XToTime(0); double snapTime = TV.TimeSnapHandler.CheckForSnapping(TV.EndTime, this); if (!Double.IsNaN(snapTime)) { TV.EndTime = snapTime; } if (TV.EndTime < TV.StartTime + 1 / 60) { TV.EndTime = TV.StartTime + 1 / 60; } } }
private void Resizer_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { MergeCancelClick(null, null); GridResizer resizer = (GridResizer)sender; double delta = (resizer.Orientation == Orientation.Vertical) ? e.HorizontalChange : e.VerticalChange; if (delta == 0) { return; } GridData.ResizeInfo resizeInfo = _data.CalculateResizeInfo(resizer, delta); if (resizeInfo.IsResizeAllowed) { if (_dragHandles.HasSnappedNonAdjacentResizers(resizer)) { double spacing = 0; MainWindowSettingsModel settings = ((App)Application.Current).MainWindowSettings; if (settings.ShowSpacing) { spacing = settings.Spacing; } _data.SplitOnDrag(resizer, delta, spacing); _dragHandles.UpdateAfterDetach(resizer, delta); } else { _data.DragResizer(resizer, resizeInfo); if (_data.SwapNegativePercents(resizer.Orientation, resizer.StartRow, resizer.EndRow, resizer.StartCol, resizer.EndCol)) { _dragHandles.UpdateAfterSwap(resizer, delta); } } } Rect workingArea = App.Overlay.WorkArea; Size actualSize = new Size(workingArea.Width, workingArea.Height); ArrangeGridRects(actualSize); AdornerLayer.UpdateLayout(); }
private void thumbPontaPencil_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { Point pos = Mouse.GetPosition(this); Point currentPoint = Mouse.GetPosition((UIElement)mw); Vector deltaVector = Point.Subtract(currentPoint, center); double angle = Vector.AngleBetween(this.startVector, deltaVector); var destAngle = this.initialAngle + Math.Round(angle, 0); //if (!Keyboard.IsKeyDown(Key.LeftCtrl)) destAngle = ((int)destAngle / 15) * 15; RenderTransform = new RotateTransform() { Angle = destAngle }; Console.WriteLine($"ANGLE={destAngle}, StartVector={startVector} CurrentPoint={currentPoint}"); }
private void OnDragTimelineDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { double currentTime = XToTime(m_DragStartPosition.X + e.HorizontalChange); var TV = App.Current.MainWindow.CompositionView.XTimeView; if (Keyboard.Modifiers == ModifierKeys.Shift) { double snapTime = TV.TimeSnapHandler.CheckForSnapping(currentTime, new List <IValueSnapAttractor>() { this, XPlayhead }); if (!Double.IsNaN(snapTime)) { currentTime = snapTime; } } App.Current.MainWindow.CompositionView.XCompositionToolBar.ManipulateTime(currentTime); }
private void GridSplitter_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { try { switch (((GridSplitter)sender).Name) { case "GS1": row2.Height = new GridLength(row2.Height.Value - e.VerticalChange, GridUnitType.Pixel); break; case "GS2": row3.Height = new GridLength(row3.Height.Value - e.VerticalChange, GridUnitType.Pixel); break; } } catch { } }
/// <summary> /// 鼠标移动方块 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { if (CanvasGrid == null) { return; } //活动对象 this.SetValue(Canvas.ZIndexProperty, Helper.ShapZIndex.Move.GetHashCode()); var left = Canvas.GetLeft(this); if (left == double.NaN) { left = 0; } var top = Canvas.GetTop(this); if (top == double.NaN) { top = 0; } left += e.HorizontalChange; top += e.VerticalChange; //保证不从左边和上边出界 if (left < 0) { left = 0; } if (top < 0) { top = 0; } Canvas.SetLeft(this, left); Canvas.SetTop(this, top); CreateInOutPosition(); MoveCallback(); }
/// <summary> /// Redraw border while dragging /// </summary> private void onDragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { //Move the Thumb to the mouse position during the drag operation double yadjust = myCanvasStretch.Height + e.VerticalChange; double xadjust = myCanvasStretch.Width + e.HorizontalChange; bool sizeChanged = false; double horizontalChange = e.HorizontalChange; double verticalChange = e.VerticalChange; if (xadjust >= this.MinBorderWidth) { myCanvasStretch.Width = xadjust; Canvas.SetLeft(myThumb, Canvas.GetLeft(myThumb) + e.HorizontalChange); this.Width += e.HorizontalChange; sizeChanged = true; } else { horizontalChange = 0; } if (yadjust >= this.MinBorderHeight) { myCanvasStretch.Height = yadjust; Canvas.SetTop(myThumb, Canvas.GetTop(myThumb) + e.VerticalChange); this.Height += e.VerticalChange; sizeChanged = true; } else { verticalChange = 0; } if (sizeChanged && this.DragDelta != null) { this.DragDelta(horizontalChange, verticalChange); } }
private void mythumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { UIElement thumb = e.Source as UIElement; //Dispatcher.Invoke(()=> { Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + e.HorizontalChange); Canvas.SetTop(thumb, Canvas.GetTop(thumb) + e.VerticalChange); //}); Canvas.SetLeft(rect, Canvas.GetLeft(thumb) + e.HorizontalChange + 10); Canvas.SetTop(rect, Canvas.GetTop(thumb) + e.VerticalChange + 10); rect.Width = Math.Abs(Canvas.GetLeft(mythumb3) - Canvas.GetLeft(mythumb1)); rect.Height = Math.Abs(Canvas.GetTop(mythumb3) - Canvas.GetTop(mythumb1)); Console.WriteLine(e.HorizontalChange.ToString() + " " + e.VerticalChange.ToString()); }
private void onDragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { // Exit dragging operation during adding new link if (isAddNewLink) { return; } Node thumb = e.Source as Node; Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + e.HorizontalChange); Canvas.SetTop(thumb, Canvas.GetTop(thumb) + e.VerticalChange); // Update links' layouts for active Node thumb.UpdateLinks(); for (int i = 0; i < thumb.LinkedNode.Count; i++) { thumb.LinkedNode[i].UpdateArrows(); } }
// hack to prevent the grid splitter from expanding the * row in the tabcontrol controltemplate from // expanding beyond the size of the window (hence obscuring the tab header buttons in docked mode) private void GridSplitter_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { // when the layer1 row0 height has reached the minimum allowed height if (layer1.RowDefinitions[0].ActualHeight <= MainContentMinHeight) { e.Handled = true; // does not work if (e.VerticalChange < 0) { // splitter moving upwards, cancel drag ((GridSplitter)sender).CancelDrag(); // restore the height of row1 layer1.RowDefinitions[1].Height = new GridLength(height); } } else { // store the current height of layer1 row1 for restore use above height = layer1.RowDefinitions[1].ActualHeight; } }
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { UIElement thumb = e.Source as UIElement; // 防止Thumb控件被拖出容器。 // if (nTop <= 0) // nTop = 0; // if (nTop >= (g.Height - myThumb.Height)) // nTop = g.Height - myThumb.Height; // if (nLeft <= 0) // nLeft = 0; // if (nLeft >= (g.Width - myThumb.Width)) // nLeft = g.Width - myThumb.Width; // Canvas.SetTop(myThumb, nTop); // Canvas.SetLeft(myThumb, nLeft); // tt.Text = "Top:" + nTop.ToString() + "\nLeft:" + nLeft.ToString(); dplDocEditor.Height = Math.Max(dplDocEditor.ActualHeight + e.VerticalChange, 0); }
/// <summary> /// Handles the DragDelta event of the Thumb_Right control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Controls.Primitives.DragDeltaEventArgs"/> instance containing the event data.</param> private void Thumb_Right_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { bool isleftdrag = e.HorizontalChange < 0; if (Math.Abs(e.HorizontalChange) > Settings.Current.MinTileWidth && this.Width >= Settings.Current.MinTileWidth) { if (!isleftdrag) { this.Width += Settings.Current.MinTileWidth; this.tileControlsGroupBarSettings.Column += 1; this.tilesControl.PushAtColumnBy(this.tilesControl.GetGroupStartColumn(this.tileControlsGroupBarSettings) - 1, 1); } else { this.Width += -1 * Settings.Current.MinTileWidth; this.tileControlsGroupBarSettings.Column -= 1; this.tilesControl.PushAtColumnBy(this.tilesControl.GetGroupStartColumn(this.tileControlsGroupBarSettings) + 1, -1); } } }
// Event on change of slider - to year private void Slider_DragDelta_1(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { Slider slider = sender as Slider; if (slider != null) { YearTo = (int)slider.Value + 1915; ToYearTextBlock.Text = YearTo.ToString(); if (YearTo < YearFrom) { ToYearTextBlock.Background = Brushes.OrangeRed; YearTo = YearFrom; } else { ToYearTextBlock.Background = Brushes.White; RefreshChoices(); } } }
// Thumb マウス移動中 Event処理 private void mark_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { // 移動量を計算し、Thumb Left/Top を設定 // GetLeft, GetTop は開始座標、e.Horiとe.Verti は移動量 var thumb = sender as System.Windows.Controls.Primitives.Thumb; int x = (int)Canvas.GetLeft(thumb); int y = (int)Canvas.GetTop(thumb); if (x >= 0) { thb_x = x; } if (y >= 0) { thb_y = y; } Canvas.SetLeft(thumb, (thb_x + e.HorizontalChange)); Canvas.SetTop(thumb, (thb_y + e.VerticalChange)); }
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { double minWidth = 100; double newWidth = navBar.ActualWidth + e.HorizontalChange; if (newWidth >= minWidth) { if (!view.IsExpanded) { view.IsExpanded = true; } navBar.MaxWidth = newWidth; } else if (newWidth < minWidth && e.HorizontalChange < 0) { view.IsExpanded = false; thumb.CancelDrag(); } }
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { var width = e.HorizontalChange; var height = e.VerticalChange; var newWidth = RulerBorder.ActualWidth + width; var newHeight = RulerBorder.ActualHeight + height; if (newWidth < _minWidth) { newWidth = _minWidth; } if (newHeight < _minHeight) { newHeight = _minHeight; } RulerBorder.Width = newWidth; RulerBorder.Height = newHeight; }
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { int horizontalChange = (int)e.HorizontalChange; int verticalChange = (int)e.VerticalChange; bool newHorizontalSizeAvailable = (canvas.ActualWidth + horizontalChange) >= 42; bool newVerticalSizeAvailable = (canvas.ActualHeight + verticalChange) >= 42; if (newHorizontalSizeAvailable) { canvas.Width += horizontalChange; Canvas.SetLeft(areaText, (canvas.ActualWidth - areaText.ActualWidth) / 2d); areaText.Text = $"{(int)canvas.ActualWidth / 20} x {(int)canvas.ActualHeight / 20}"; } if (newVerticalSizeAvailable) { canvas.Height += verticalChange; Canvas.SetTop(areaText, (canvas.ActualHeight - areaText.ActualHeight) / 2d); areaText.Text = $"{(int)canvas.ActualWidth / 20} x {(int)canvas.ActualHeight / 20}"; } }
// Event on change of slider - to popularityTo private void Slider_DragDelta_33(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { Slider slider = sender as Slider; if (slider != null) { popularityTo = (int)slider.Value; PopularitySliderToTextBlock.Text = popularityTo.ToString(); if (popularityTo < popularityFrom) { PopularitySliderToTextBlock.Background = Brushes.OrangeRed; popularityTo = popularityFrom; RefreshChoices(); } else { PopularitySliderToTextBlock.Background = Brushes.White; RefreshChoices(); } } }
private void ThumbViewport_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { var smallImgWidth = SmallImage.ActualWidth; var smallImgHeight = SmallImage.ActualHeight; MyScrollViewer.ScrollToHorizontalOffset( MyScrollViewer.HorizontalOffset + (e.HorizontalChange * MyScrollViewer.ExtentWidth / smallImgWidth)); MyScrollViewer.ScrollToVerticalOffset( MyScrollViewer.VerticalOffset + (e.VerticalChange * MyScrollViewer.ExtentHeight / smallImgHeight)); //Canvasの外に出ないように var setLeft = Canvas.GetLeft(ThumbViewport) + e.HorizontalChange; var setTop = Canvas.GetTop(ThumbViewport) + e.VerticalChange; var right = setLeft + ThumbViewport.ActualWidth; var bottom = setTop + ThumbViewport.ActualHeight; if (0 < setLeft && 0 < setTop && right < smallImgWidth && bottom < smallImgHeight) { Canvas.SetLeft(ThumbViewport, setLeft); Canvas.SetTop(ThumbViewport, setTop); } }
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { double maxHeight = ((FrameworkElement)Parent).ActualHeight - 20; // 20 = estimated expander height. if (maxHeight < 0) { maxHeight = 0; } double height = _xmlTextBox.Height - e.VerticalChange; if (height > maxHeight) { height = maxHeight; } else if (height <= 25) { height = 25; } _xmlTextBox.Height = height; }
void OnResizerDragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { LayoutGridResizerControl splitter = sender as LayoutGridResizerControl; var rootVisual = this.FindVisualTreeRoot() as Visual; var trToWnd = TransformToAncestor(rootVisual); Vector transformedDelta = trToWnd.Transform(new Point(e.HorizontalChange, e.VerticalChange)) - trToWnd.Transform(new Point()); if (_side == AnchorSide.Right || _side == AnchorSide.Left) { if (FrameworkElement.GetFlowDirection(_internalHost) == System.Windows.FlowDirection.RightToLeft) { transformedDelta.X = -transformedDelta.X; } Canvas.SetLeft(_resizerGhost, MathHelper.MinMax(_initialStartPoint.X + transformedDelta.X, 0.0, _resizerWindowHost.Width - _resizerGhost.Width)); } else { Canvas.SetTop(_resizerGhost, MathHelper.MinMax(_initialStartPoint.Y + transformedDelta.Y, 0.0, _resizerWindowHost.Height - _resizerGhost.Height)); } }
private void Resizer_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { GridResizer resizer = (GridResizer)sender; int[] percents; RowColInfo[] info; int index = resizer.Index; double delta; if (resizer.Orientation == Orientation.Vertical) { percents = Model.ColumnPercents; info = _colInfo; delta = e.HorizontalChange; } else { percents = Model.RowPercents; info = _rowInfo; delta = e.VerticalChange; } double currentExtent = info[index].Extent; double newExtent = currentExtent + delta; int currentPercent = info[index].Percent; int totalPercent = currentPercent + info[index + 1].Percent; int newPercent = (int)(currentPercent * newExtent / currentExtent); if ((newPercent > 0) && (newPercent < totalPercent)) { percents[index] = info[index].Percent = newPercent; percents[index + 1] = info[index + 1].Percent = totalPercent - newPercent; Size actualSize = new Size(ActualWidth, ActualHeight); ArrangeGridRects(actualSize); } }
private void Move_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { double deltaX = e.HorizontalChange / (currentCanvas.ZoomPerCent / 100.0); double deltaY = e.VerticalChange / (currentCanvas.ZoomPerCent / 100.0); trgCell.TempLayer.Rect.OffsetX += deltaX; trgCell.TempLayer.Rect.OffsetY -= deltaY; trgCell.PixcelSelectedArea.Rect.OffsetX += deltaX; trgCell.PixcelSelectedArea.Rect.OffsetY -= deltaY; AddOffset(move, deltaX, deltaY); AddOffset(selectingAreaRect, deltaX, deltaY); AddOffset(topLeft, deltaX, deltaY); AddOffset(topRight, deltaX, deltaY); AddOffset(bottomLeft, deltaX, deltaY); AddOffset(bottomRight, deltaX, deltaY); AddOffset(left, deltaX, deltaY); AddOffset(right, deltaX, deltaY); AddOffset(top, deltaX, deltaY); AddOffset(bottom, deltaX, deltaY); IBCanvasControl.RefreshAll(); }
private void DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { double left = this.Margin.Left + e.HorizontalChange; if (left < 0) { left = 0; } if (left > Obj.screenMap.MainMap.ActualWidth - 10) { left = Obj.screenMap.MainMap.ActualWidth - 10; } double top = this.Margin.Top + e.VerticalChange; if (top < 0) { top = 0; } if (top > Obj.screenMap.MainMap.ActualHeight - 10) { top = Obj.screenMap.MainMap.ActualHeight - 10; } this.Margin = new Thickness(left, top, 0, 0); }
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { _left = Canvas.GetLeft(resizeGrid) + e.HorizontalChange; _top = Canvas.GetTop(resizeGrid) + e.VerticalChange; if (_left < 0) { _left = 0; } else if (_left > canvas.Width - resizeGrid.ActualWidth) { _left = canvas.Width - resizeGrid.ActualWidth; } if (_top < 0) { _top = 0; } else if (_top > canvas.Height - resizeGrid.ActualHeight) { _top = canvas.Height - resizeGrid.ActualHeight; } Canvas.SetLeft(resizeGrid, _left); Canvas.SetTop(resizeGrid, _top); }
private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { this.Left += e.HorizontalChange; this.Top += e.VerticalChange; }
private void MoveThumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { RefCropImage(); }