private void OnImageResized(object sender, SizeChangedEventArgs args) { InsetImage insetImage = null; if (args.UIElement is Canvas && _imageDictionary.TryGetValue(((Canvas)args.UIElement).Name, out insetImage)) { insetImage.Resize(args.X, args.Y, args.ResizeType); } }
public bool AddInsetPhoto(Uri imageUri) { InsetImage insetImage = new InsetImage(imageUri); Canvas imageCanvas = insetImage.ImageCanvas; if (imageCanvas != null) { _imageDictionary.Add(imageCanvas.Name, insetImage); _mainCanvas.Children.Add(imageCanvas); DynamicCanvas.SetLeft(imageCanvas, DefaultLeft); DynamicCanvas.SetTop(imageCanvas, DefaultTop); AddInsetImageUndo(imageCanvas); return(true); } return(false); }
public bool AddInsetPhoto(ImageSource imageSource, double imageWidth, double borderWidth, double imageX, double imageY) { InsetImage insetImage = new InsetImage(imageWidth, imageSource, borderWidth); Canvas imageCanvas = insetImage.ImageCanvas; if (imageCanvas != null) { _imageDictionary.Add(imageCanvas.Name, insetImage); _mainCanvas.Children.Add(imageCanvas); DynamicCanvas.SetLeft(imageCanvas, imageX); DynamicCanvas.SetTop(imageCanvas, imageY); AddInsetImageUndo(imageCanvas); return(true); } return(false); }