using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Interop; namespace WpfSketch { public class ImageSketch { public ImageSketch(IntPtr hwnd) { System.Windows.Media.Imaging.BitmapSource returnImage = null; System.Windows.IDataObject data = System.Windows.Clipboard.GetDataObject(); var formats = data.GetFormats(); if (System.Windows.Clipboard.ContainsImage()) { returnImage = System.Windows.Clipboard.GetImage(); Window1 main = new Window1(returnImage); WindowInteropHelper helper = new WindowInteropHelper(main); helper.Owner = hwnd; //Clipboard.SetImage(replacementImage); main.ImageSaveEvent += (image) => { System.Windows.Clipboard.SetImage(image); }; main.ShowDialog(); } } } }