/// <summary> /// 监听stroke变化事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Strokes_StrokesChanged(object sender, StrokeCollectionChangedEventArgs e) { StrokeCollection added = new StrokeCollection(e.Added); StrokeCollection removed = new StrokeCollection(e.Removed); CommandItem item = new StrokesAddedOrRemovedCI(_cmdStack, canvas.EditingMode, added, removed, _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); }