//为草图加上红边框 public static void AddBound(MyImage image) { if (image.Bound == null) { Rectangle bound = new Rectangle(); bound.HorizontalAlignment = HorizontalAlignment.Left; bound.VerticalAlignment = VerticalAlignment.Top; bound.Margin = new Thickness(image.Left, image.Top, 0, 0); bound.Width = image.Width; bound.Height = image.Height; bound.Stroke = new SolidColorBrush(Colors.Red); bound.StrokeThickness = 5; if (image.Bound != null) { bound.RenderTransform = image.Bound.RenderTransform; } image.Bound = bound; } else { image.Bound.Margin = new Thickness(image.Left, image.Top, 0, 0); image.Bound.Width = image.Width; image.Bound.Height = image.Height; } }
public ImageConnector(MyImage source, MyImage target) { this.source = source; this.target = target; StylusPointCollection collection = Connector.getInstance().getImageConnector(source, target); stroke = new MyStroke(new Stroke(collection)); source.addConnector(this); target.addConnector(this); }
/// <summary> /// 增加一个image /// </summary> /// <param name="image"></param> public void AddImage(MyImage image) { if (videoPath != "") { image.VideoPath = videoPath; } int index = Sketch.Images.Count; _inkCanvas.Children.Insert(index, image.Image); image.Bound.Visibility = Visibility.Collapsed; _inkCanvas.Children.Add(image.Bound); Sketch.AddImage(image); }
/// <summary> /// 删除一个图片 /// </summary> /// <param name="_image"></param> public void RemoveImage(MyImage _image) { Images.Remove(_image); }
/// <summary> /// 增加一个图片 /// </summary> /// <param name="image"></param> public void AddImage(MyImage image) { Images.Add(image); }
/// <summary> /// 构造函数 /// </summary> /// <param name="image">图片</param> /// <param name="offsetx">移动x距离</param> /// <param name="offsety">移动y距离</param> public ImageMoveCommand(WPFInk.ink.MyImage image, double offsetx, double offsety) { this.image = image; this.offset_x = offsetx; this.offset_y = offsety; }
/// <summary> /// 删除图片 /// </summary> /// <param name="image"></param> public void RemoveImage(MyImage image) { _inkCanvas.Children.Remove(image.Image); _inkCanvas.Children.Remove(image.Bound); Sketch.RemoveImage(image); }