public void Add_A_Picture(string MyFileName, Guid thumbID) { TouchImage MyImage = new TouchImage(thumbID); BitmapImage src = new BitmapImage(); src.BeginInit(); src.UriSource = new Uri(MyFileName, UriKind.RelativeOrAbsolute); src.EndInit(); if (src.PixelHeight > 3000) { src.DecodePixelHeight = 3000; } int MyImageNo = this.Children.Count; MyImage.Source = src; MyImage.Height = 300; MyImage.IsManipulationEnabled = true; MyImage.Name = "Image" + MyImageNo.ToString(); MyImage.Stretch = Stretch.UniformToFill; MyImage.RenderTransform = new MatrixTransform(1, 0, 0, 1, 200 + 10 * MyImageNo, 200 + 10 * MyImageNo); RenderOptions.SetBitmapScalingMode(MyImage, BitmapScalingMode.HighQuality); this.Children.Add(MyImage); }
private TouchImage FindPicture(Guid thumbID) { foreach (UIElement elem in this.Children) { TouchImage image = elem as TouchImage; if (image != null) { if (image.ThumbID == thumbID) { return(image); } } } return(null); }
public void RemovePicture(Guid thumID) { TouchImage image = FindPicture(thumID); RemovePicture(image); }
private void RemovePicture(TouchImage image) { this.Children.Remove(image); }