You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.0 KiB
C#

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();
}
}
}
}