// </Snippet14> //<Snippet13> void inkCanvas1_SelectionMoving(object sender, InkCanvasSelectionEditingEventArgs e) { // Allow the selection to only move horizontally. Rect newRect = e.NewRectangle; e.NewRectangle = new Rect(newRect.X, e.OldRectangle.Y, newRect.Width, newRect.Height); }
/// <summary> /// Helper method that take a finalRectangle and raised the appropriate /// events on the InkCanvas. Handles cancellation /// </summary> private void CommitResizeChange(Rect finalRectangle) { Rect selectionBounds = SelectionBounds; // // *** RESIZED *** // InkCanvasSelectionEditingEventArgs args = new InkCanvasSelectionEditingEventArgs(selectionBounds, finalRectangle); _inkCanvas.RaiseSelectionResizing(args); if (!args.Cancel) { if (finalRectangle != args.NewRectangle) { finalRectangle = args.NewRectangle; } // // perform the move // MoveSelection(selectionBounds, finalRectangle); // // raise the 'changed' event // _inkCanvas.RaiseSelectionResized(EventArgs.Empty); } }
// Don't allow the user to make the selection smaller than its original size. void inkCanvas1_SelectionResizing(object sender, InkCanvasSelectionEditingEventArgs e) { if (selectionBounds == null || selectionBounds.IsEmpty) { return; } double resizeHeight; double resizeWidth; // If the user made the height of the selection smaller, // use the selection's original height. if (e.NewRectangle.Height < selectionBounds.Height) { resizeHeight = selectionBounds.Height; } else { resizeHeight = e.NewRectangle.Height; } // If the user made the width of the selection smaller, // use the selection's original width. if (e.NewRectangle.Width < selectionBounds.Width) { resizeWidth = selectionBounds.Width; } else { resizeWidth = e.NewRectangle.Width; } // Create a the new rectangle with the appropriate width and height. e.NewRectangle = new Rect(e.NewRectangle.X, e.NewRectangle.Y, resizeWidth, resizeHeight); }
protected override void OnSelectionResizing(InkCanvasSelectionEditingEventArgs e) { try { var moveX = e.NewRectangle.Left - e.OldRectangle.Left; var moveY = e.NewRectangle.Top - e.OldRectangle.Top; /* similar to moving, the rectangle top and left need to affect the * RenderTransform of all node shapes. */ //foreach (FrameworkElement element in // Selection.SelectedShapes.Cast<FrameworkElement>().Where(element => nodeShapes.Contains(element))) //{ // element.SetValue(LeftProperty, double.NaN); // element.SetValue(TopProperty, double.NaN); // element.SetValue(RightProperty, double.NaN); // element.SetValue(BottomProperty, double.NaN); // element.RenderTransform = new MatrixTransform( // element.RenderTransform.Value.M11, // element.RenderTransform.Value.M12, // element.RenderTransform.Value.M21, // element.RenderTransform.Value.M22, // element.RenderTransform.Value.OffsetX + moveX, // element.RenderTransform.Value.OffsetY + moveY); //} base.OnSelectionResizing(e); storeOnUndoStack(); } catch (Exception exc) { ErrorLogger.Catch(exc); } }
private void InkCanvasOnSelectionMoving(object sender, InkCanvasSelectionEditingEventArgs e) { var shiftX = e.OldRectangle.X - e.NewRectangle.X; var shiftY = e.OldRectangle.Y - e.NewRectangle.Y; _rotatePoint = new Point(_rotatePoint.X - shiftX, _rotatePoint.Y - shiftY); }
// Token: 0x06006D8A RID: 28042 RVA: 0x001F75A0 File Offset: 0x001F57A0 private void CommitResizeChange(Rect finalRectangle) { Rect selectionBounds = this.SelectionBounds; InkCanvasSelectionEditingEventArgs inkCanvasSelectionEditingEventArgs = new InkCanvasSelectionEditingEventArgs(selectionBounds, finalRectangle); this._inkCanvas.RaiseSelectionResizing(inkCanvasSelectionEditingEventArgs); if (!inkCanvasSelectionEditingEventArgs.Cancel) { if (finalRectangle != inkCanvasSelectionEditingEventArgs.NewRectangle) { finalRectangle = inkCanvasSelectionEditingEventArgs.NewRectangle; } this.MoveSelection(selectionBounds, finalRectangle); this._inkCanvas.RaiseSelectionResized(EventArgs.Empty); } }
/// <summary> /// Enabling undo/redo for selections moving or resizing. /// </summary> void MyInkCanvas_SelectionMovingOrResizing(object sender, InkCanvasSelectionEditingEventArgs e) { // Enforce stroke bounds to positive territory. Rect newRect = e.NewRectangle; Rect oldRect = e.OldRectangle; if (newRect.Top < 0d || newRect.Left < 0d) { Rect newRect2 = new Rect(newRect.Left < 0d ? 0d : newRect.Left, newRect.Top < 0d ? 0d : newRect.Top, newRect.Width, newRect.Height); e.NewRectangle = newRect2; } CommandItem item = new SelectionMovedOrResizedCI(_cmdStack, MyInkCanvas.GetSelectedStrokes(), newRect, oldRect, _editingOperationCount); _cmdStack.Enqueue(item); }
private void InkCanvas_SelectionResizingOrMoving(object sender, InkCanvasSelectionEditingEventArgs e) { Rect newRect = e.NewRectangle; Rect oldRect = e.OldRectangle; if (newRect.Top < 0d || newRect.Left < 0d) { Rect newRect2 = new Rect(newRect.Left < 0d ? 0d : newRect.Left, newRect.Top < 0d ? 0d : newRect.Top, newRect.Width, newRect.Height); e.NewRectangle = newRect2; } CommandItem item = new SelectionMovedOrResizedCommandItem(_commandStack, _drawingBoardView.InkCanvas.GetSelectedStrokes(), newRect, oldRect, _editingOperationCount); _commandStack.Enqueue(item); }
private void Canvas_SelectionMovingOrResizing(object sender, InkCanvasSelectionEditingEventArgs e) { Rect newRect = e.NewRectangle; Rect oldRect = e.OldRectangle; if (newRect.Top < 0d || newRect.Left < 0d) { Rect newRect2 = new Rect(newRect.Left < 0d ? 0d : newRect.Left, newRect.Top < 0d ? 0d : newRect.Top, newRect.Width, newRect.Height); e.NewRectangle = newRect2; } FieldSizeText = (int)newRect.Width + "," + (int)newRect.Height + " 像素"; editingOperationCount++; CommandItem item = new SelectionMovedOrResizedCI(doCmdStack, inkCanvas.GetSelectedStrokes(), newRect, oldRect, editingOperationCount); doCmdStack.Enqueue(item); }
private void SelectionResizing(object sender, InkCanvasSelectionEditingEventArgs e) { Trace.WriteLine("InkCanvas selection resizing."); }
protected override void OnSelectionResizing(InkCanvasSelectionEditingEventArgs e) { Console.WriteLine("OnSelectionResizing"); base.OnSelectionResizing(e); }
protected override void OnSelectionResizing(InkCanvasSelectionEditingEventArgs e) { base.OnSelectionResizing(e); }
/// <summary> /// Creates the command with information from the move/resize event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void inkPic_SelectionMovingResizing(object sender, InkCanvasSelectionEditingEventArgs e) { // Create the command with arguments from before-the-event hook c = new CommandList.MoveResizeCmd(ref inkSketch, e.OldRectangle, e.NewRectangle); }
void surfaceDessin_SelectionMoving(object sender, InkCanvasSelectionEditingEventArgs e) { // this.surfaceDessin.IsDraging = true; }
private void surfaceDessin_SelectionResizing(object sender, InkCanvasSelectionEditingEventArgs e)//object sender, InkCanvasSelectionEditingEventArgs e) { this.surfaceDessin.Select(surfaceDessin.GetSelectedStrokes()); this.surfaceDessin.IsDraging = true; //(DataContext as VueModele).HandleResize(); }
private void InkCanvas_SelectionResizing(object sender, InkCanvasSelectionEditingEventArgs e) { textBox.Text += "InkCanvas_SelectionResizing\n"; }