Say if I have an image path C:\MyImages\MyImage.jpg
how would I get this onto the clipboard using C#.
I know I would use the class System.Windows.Clipboard.SetImage();
but this takes a BitmapSource
as the parameter. How would I get a BitmapSource
object to feed into this method from the given path?
BitmapSource bitmapSource = new BitmapImage(new Uri("C:\\MyImages\\MyImage.jpg"));
System.Windows.Clipboard.SetImage(bitmapSource);