public override bool Merge(CommandItem newitem) { SelectionMovedOrResizedCI newitemx = newitem as SelectionMovedOrResizedCI; // Ensure items are of the same type. if (newitemx == null || newitemx._editingOperationCount != _editingOperationCount || !StrokeCollectionsAreEqual(newitemx._selection, _selection)) { return(false); } // Keep former oldrect, latter newrect. _newrect = newitemx._newrect; return(true); }
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); }